nvm: "nvm use" gets stuck in inifinite loop causing a fork bomb
-
Operating system and version: Linux bash 4.2 terminal on web host
-
nvm debug
output:
$SHELL: /bin/bash
$SHLVL: 1
$HOME: /home/domainnamehere
$NVM_DIR: '$HOME/.nvm'
$PATH: /usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin:/opt/cpanel/composer/bin:$HOME/.local/bin:$HOME/bin
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 3.10.0-962.3.2.lve1.5.24.9.el7.x86_64 #1 SMP Wed Feb 13 08:24:50 EST 2019 x86_64 x86_64 x86_64 GNU/Linux'
curl: /bin/curl, curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.36 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
wget: /bin/wget, GNU Wget 1.14 built on linux-gnu.
git: /usr/local/cpanel/3rdparty/lib/path-bin/git, git version 2.19.1
grep: alias grep='grep --color=auto'
/bin/grep (grep --color=auto), grep (GNU grep) 2.20
awk: /bin/awk, GNU Awk 4.0.2
sed: /bin/sed, sed (GNU sed) 4.2.2
cut: /bin/cut, cut (GNU coreutils) 8.22
basename: /bin/basename, basename (GNU coreutils) 8.22
rm: /bin/rm, rm (GNU coreutils) 8.22
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.22
xargs: /bin/xargs, xargs (GNU findutils) 4.5.11
(Omitted the last lines as nvm is being started with --no-use)
-
nvm ls
output:v12.3.1
-
How did you install
nvm
? (e.g. install script in readme, Homebrew): Using the install scriptcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
-
What steps did you perform? I’ve added --no-use to the end of my .bashrc so that I can at least access the terminal before the issue occurs, but once I have terminal access I tried calling
nvm use default
to load node -
What happened? the number of resources being used on the server ballooned to the point where I was only getting
bash: fork: retry: no child processes
andbash: fork: retry: resource temporarily unavailable
-
What did you expect to happen? nvm use node without creating a fork bomb/depleting all server resources. The issue doesn’t occur when
nvm use
isn’t called, or if I don’t let nvm start at all -
Is there anything in any of your profile files (
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
? .bash_profile contains the following:
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 24 (12 by maintainers)
All good, thanks for persisting. I’ve got a minor workaround at the moment which is just to add
--no-use
onto .bashrc andpkill -f node
before callingnvm use default
which avoids the error. Not exactly best practice and can be annoying to always have to restart processes but it works for now until I can find the root cause of the problem.Here is the result: https://pastebin.com/q6rm70P8 (Pastebin link as it is quite long)