[Pkg-javascript-devel] Bug#1030284: nodejs: [arm64] RangeError: Maximum call stack size exceeded
James Addison
jay at jp-hosting.net
Sat May 13 12:45:24 BST 2023
On Sat, 13 May 2023 at 12:15, James Addison <jay at jp-hosting.net> wrote:
>
> On Sat, 13 May 2023 at 11:14, James Addison <jay at jp-hosting.net> wrote:
> >
> > On Sat, 13 May 2023 at 02:18, Thorsten Glaser <tg at debian.org> wrote:
> > >
> > > James Addison dixit:
> > >
> > > >I'm going to stay involved with this thread, but I think that it is
> > > >upon you to develop or provide further guidance towards a patch if
> > > >it's something you'd like to have implemented, Thorsten.
> > >
> > > I actually have looked into that but I don’t understand the nodejs
> > > and v8 source code enough to be able. I know C, but not CFrustFrust.
> > > I would rather prefer asm…
> >
> > Ok, thanks. We may be stalled temporarily in that case.
> >
> > On Sat, 13 May 2023 at 00:20, James Addison <jay at jp-hosting.net> wrote:
> > > That said: perhaps it could be useful if someone could check whether
> > > the following commit is relevant to this:
> > > https://github.com/libuv/libuv/commit/18c7530a75d813801f819caae4dff47fc4a1d4a1
> >
> > I ran the repro case (with some simplifications) from the GitHub
> > thread using 'strace' and grepped for rlimit-related syscalls:
> >
> > # on arm64, this currently replicates the problem using debian bookworm
> > $ strace babeljs --config-file $PWD/babel.config.json --compact
> > false --source-maps inline -d tests5 auto_tests 2>&1 | grep -i rlimit
> >
> > All of the resulting calls (on an ARM64 host) are to the 'prlimit64'
> > syscall and have a zero exit-code (success).
>
> How about extending the code around after this block:
> https://github.com/nodejs/node/blob/2bb4b59fa5529569ad38d3bf7d36666c926d8e47/src/node.cc#L781-L786
>
> ... to add something like this:
>
> if (!(flags & ProcessInitializationFlags::kNoAdjustResourceLimits)) {
> struct rlimit lim;
> if (getrlimit(RLIMIT_STACK, &lim) == 0) {
> char stackSize[32];
> int buflen = snprintf(stackSize, sizeof(stackSize),
> "--stack-size=%d", lim.rlim_cur);
> if (buflen < sizeof(stackSize)) {
> V8::SetFlagsFromString(stackSize, buflen);
> }
> }
> }
>
> ?
Note: probably worth adjusting that to add another conditional to
check that the stack limit isn't unset/infinity:
if (getrlimit(RLIMIT_STACK, &lim) == 0 && lim.rlim_max != RLIM_INFINITY) {
I'm not sure that I have an ARM64 machine with enough memory and/or
non-flash-based disk to want to compile and test this on. But
hopefully it would be fairly straightforward (apt source nodejs, apt
build-dep ., dpkg-buildpackage, or something along those lines).
More information about the Pkg-javascript-devel
mailing list