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

nvm.sh spawns zombie processes when running on zsh in Docker #650

Closed
soareschen opened this issue Feb 9, 2015 · 3 comments
Closed

nvm.sh spawns zombie processes when running on zsh in Docker #650

soareschen opened this issue Feb 9, 2015 · 3 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR. shell: zsh

Comments

@soareschen
Copy link

When docker exec into a Docker container with zsh as shell, nvm.shwould generate a dozens of zombie processes. This problem only arise when nvm is running on zsh. There is no zombie process when running nvm with bash.

I understand that many Docker containers do not run with a proper init process, and it is inevitable that zombie process will eventually lurk out. But I also want to avoid as much zombie process as possible and try to get nvm work well with most Docker containers.

Sample command line output:

docker exec -it $IMAGE_ID /bin/zsh
source ~/.nvm/nvm.sh
ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.1  0.4  19388  4248 ?        Ss+  10:49   0:00 /bin/bash
root       145  0.5  0.4  34792  4720 ?        S+   10:49   0:00 /bin/zsh
root       170  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       175  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       177  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       182  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       183  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       184  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       186  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       191  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       220  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       222  0.0  0.0      0     0 ?        Z+   10:49   0:00 [grep] <defunct>
root       223  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       224  0.0  0.0      0     0 ?        Z+   10:49   0:00 [grep] <defunct>
root       225  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       226  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       227  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       228  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       229  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sort] <defunct>
root       230  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sort] <defunct>
root       231  0.0  0.0      0     0 ?        Z+   10:49   0:00 [sed] <defunct>
root       237  0.0  0.0      0     0 ?        Z+   10:49   0:00 [zsh] <defunct>
root       249  0.0  0.2  15576  2156 ?        R+   10:49   0:00 ps aux
@ljharb
Copy link
Member

ljharb commented Feb 9, 2015

nvm does launch a large number of subshells, but I'm not sure why they'd be zombies, since they're just executed, and their output captured.

I'll certainly leave this open, but I have no idea how to fix this - does this ever happen with zsh outside of Docker?

@ljharb ljharb added needs followup We need some info or action from whoever filed this issue/PR. shell: zsh labels Feb 9, 2015
dqminh added a commit to dqminh/libcontainer that referenced this issue Feb 10, 2015
When running under child subreaper mode, it's useful for nsenter to be able to
reap child processes. We have seen cases where spawned user processes wasnt
reaped properly (nvm-sh/nvm#650)

Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com>
@soareschen
Copy link
Author

I have done more testing and confirmed that this is a bug on both zsh and Docker. So it is not really a problem of nvm. More details at https://gist.github.com/soareschen/240e49116c7f2632d179

@ljharb
Copy link
Member

ljharb commented Feb 11, 2015

Phew, thanks for clarifying. I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR. shell: zsh
Projects
None yet
Development

No branches or pull requests

2 participants