Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Zsh scripts leave defunct processes when running under docker exec
- X-seq: zsh-workers 34503
- From: Soares Chen <soares.chen@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Zsh scripts leave defunct processes when running under docker exec
- Date: Wed, 11 Feb 2015 12:43:47 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=NZQH0Vk4te75Yk66Tn5NcImssdl9oQ5HOUvKsvfyTyc=; b=Cq/pbkPArV2Mp1Yyper9QkzbqAcJ2HwQZqK3NppJ2sgjunbdp1pBH2Mw7hp2TXJhOJ ZJM8yCkPXwkMroF0WCWdNJua99Iy1L6esUj4om6sGyF/WNgqFJtGncpmtn5hgTxqZm51 yQw1D5rU7CUTtOPPEqYQMIcuq5KI7OjgbKtZ3/za/dzBBzqAulseAimA1xtZO5nmXuca JlRLBLtZeioRemvANF6lcz5oQo5w4Ul29BMW7vEEuYdq2tJYSR2HY4LJ/MClYCM/U//B xocSbyp57LAHfO1SJtMbDryLehgrtUL5HS69W0JmqW09VfdPO4OfHwkjVEtO15eQDy34 irEA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This only happens when the script is running inside a shell spawned by
`docker exec`. When running under normal system and under `docker
run`, there is no defunct process.
This bug is first discovered when I run nvm in docker
(https://github.com/creationix/nvm/issues/650). It was then discovered
that Docker's nsenter did not properly handle the SIGCHLD signal
raised from zsh. (https://github.com/docker/libcontainer/pull/369)
Even though it is now been fixed by Docker, I am not sure why zsh
would cause this bug in the first place.
I have a test script at the end of this post and also share it on
https://gist.github.com/soareschen/240e49116c7f2632d179
Steps to reproduce:
# terminal 1
docker run -it --rm --name test-zsh ubuntu:latest /bin/bash
apt-get install zsh curl
curl https://gist.githubusercontent.com/soareschen/240e49116c7f2632d179/raw/0be67acefd8d18fd62bb181998996f9a5772dc64/docker-zsh-test.sh
> docker-zsh-test.sh
chmod +x docker-zsh-test.sh
./docker-zsh-test.sh
ps auxf # no defunct process
# terminal 2
docker exec -it test-zsh /bin/zsh
./docker-zsh-test.sh
ps auxf # sed and zsh shown as defunct processes
#!/bin/zsh
# docker-zsh-test.sh
if [[ "$(echo "the black cat was chased by the brown dog" | sed -e
's/cat/fox/g' | grep fox)" = "" ]]; then
echo "cat"
else
echo "fox"
fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author