Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node spins forever? #438

Closed
rotu opened this issue Jan 10, 2025 · 4 comments
Closed

node spins forever? #438

rotu opened this issue Jan 10, 2025 · 4 comments

Comments

@rotu
Copy link

rotu commented Jan 10, 2025

npm seems to cause the process to spin forever.

This happens with every alpine version from 3.19.0 through edge and may be related to running ARM32 emulation on a 64-bit processor.

docker run --platform=linux/arm -it --rm alpine:3.21.2 ash -c 'apk add nodejs npm && npm --version'
@rotu
Copy link
Author

rotu commented Jan 10, 2025

This appears to be the same issue as nodejs/docker-node#1946.

@fossdd
Copy link

fossdd commented Jan 10, 2025

For me it seems to work. It seems like a really not-nice random bug in npm.

➜  ~ podman run --platform=linux/arm -it --rm alpine:3.21.2 ash -c 'apk add nodejs npm && npm --version'      
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/alpine:3.21.2...
Getting image source signatures
Copying blob 824bc99f06f2 done   | 
Copying config f5d8035bc4 done   | 
Writing manifest to image destination
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/armv7/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/armv7/APKINDEX.tar.gz
(1/14) Installing ca-certificates (20241121-r1)
(2/14) Installing libgcc (14.2.0-r4)
(3/14) Installing libstdc++ (14.2.0-r4)
(4/14) Installing ada-libs (2.9.2-r1)
(5/14) Installing brotli-libs (1.1.0-r2)
(6/14) Installing c-ares (1.34.3-r0)
(7/14) Installing icu-data-en (74.2-r0)
Executing icu-data-en-74.2-r0.post-install
*
* If you need ICU with non-English locales and legacy charset support, install
* package icu-data-full.
*
(8/14) Installing icu-libs (74.2-r0)
(9/14) Installing nghttp2-libs (1.64.0-r0)
(10/14) Installing simdjson (3.10.1-r0)
(11/14) Installing simdutf (5.6.3-r0)
(12/14) Installing sqlite-libs (3.47.1-r0)
(13/14) Installing nodejs (22.11.0-r1)
(14/14) Installing npm (10.9.1-r0)
Executing busybox-1.37.0-r9.trigger
Executing ca-certificates-20241121-r1.trigger
OK: 64 MiB in 29 packages
10.9.1
➜  ~ 

@rotu
Copy link
Author

rotu commented Jan 10, 2025

Okay I'm sufficiently confused by lots of things when trying to reliably reproduce this.

I was counfounded by https://gitlab.alpinelinux.org/alpine/aports/-/issues/16400; installing npm installs nodejs-current not nodejs. These versions differ on alpine 3.18. This was changed in 3.21 where apk add npm install nodejs instead of nodejs-current. So the issue began sometime between Node 18.20.1 and Node 20.8.1.

It seems I can reproduce this even on 3.18 when using nodejs-current instead of nodejs and without npm at all. The common strand is emulating 32-bit ARM. Even

docker run --platform=linux/arm --rm -it alpine:3.18 ash -c 'apk add nodejs-current && node --print 42'

It also pegs one CPU at 100% while it's happening.

I found this to happen on both my M3 Mac and my x64 Windows computer running Docker. The common thread is arm/v6 or arm/v7 emulation. This does not happen with arm64/v8 on either machine.

@rotu rotu changed the title Npm spins forever? node spins forever? Jan 10, 2025
@rotu
Copy link
Author

rotu commented Jan 12, 2025

This is a duplicate of nodejs/node#53489. Confirmed by running with strace:

$ docker run --platform=linux/arm --rm -e QEMU_STRACE=1 -it alpine:edge ash -c 'apk add nodejs-current && node -p 42'

which eventually gets into printing these messages:

1 mremap(940810240,4096,8192,0,0,1082132616) = -1 errno=12 (Out of memory)
1 mremap(940806144,4096,8192,0,0,1082132616) = -1 errno=12 (Out of memory)
1 mremap(940802048,4096,8192,0,0,1082132616) = -1 errno=12 (Out of memory)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants