-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Handling of zombie processes would be useful #54
Comments
Friendly paste :) |
I'm seeing some zombie ssh processes as well. |
zombies accumulate indeed $ ps fauwwwx | grep defunct | wc -l 68 |
Hi there, I ran into this exact issue and created https://github.com/krallin/tini as a solution. The idea was to have a drop-in "zombie reaper" that doesn't do anything else (in comparison phusion's My
@ndeloof - Would it make sense to make a PR to add Obviously, pulling the binary directly (which is what I pasted above) may not be desirable, but I have code here that can be used to build |
I had the same issue and it was making some Jenkins jobs failing because the job was involving some tests that were checking running processes. I applied the solution proposed by krallin and it is now working. It would be great to include a solution in the base image. |
I wonder why this appear as a docker image issue, not a generic jenkins issue. Jenkins is (supposed to) kill all processes after build completion, so should not generate such zombie processes (until there's something docker-specific I'm missing) proposed |
@ndeloof This is not correct. Lets consider following process tree: jenkins -- bash -- python. If bash dies unexpectedly (ie. kill -9) python process will have no parent. In such case parent will be changed automatically by kernel to PID 1 (init process in normal Linux based system). In such case Jenkins can and should clean up after bash. But python is not Jenkins business anymore, because it is not in his process tree anymore. So python won't be cleaned by Jenkins, but it will be detected by init process as new child and cleaned up by init. But in your container PID 1 is Jenkins. So this python process will be stuck as zombie process forever. |
Jenkins do rely on inherited env to detect child processes created by a job and kill them on build completion. Need to experiment with this and try to find a jenkins-centric fix for it, better than hacking the docker image. Thanks for the detailed description |
@ndeloof , Note that zombie reaping wouldn't necessarily be that useful in Jenkins outside of a Docker environment, considering zombies are usually reaped by Cheers, |
tini indeed seems to be the sole option we have. Sorry I didn't understood the issue first time I commented here |
Yes, it requires a system call. It's pretty easy to write a CLI tool to do it (it persists across a fork). You'd also need to actually reap zombies though. Cheers, |
Prevent jenkins to leak zombie processes
@krallin [root@docker32-111 ~]# docker ps -a [root@docker32-111 ~]# ps -elf | grep -v grep | grep defunct pid 15507 is tini process: and the tini cmd name displays wrong, the normal is "/bin/tini -- /usr/local/bin/jenkins.sh" but not "[tini]" there are lots of child processes of 15524, and the status all is D here is Dockerfile entrypoint: Is there any good suggestions ? |
[JENKINS-42846] - Rename slave.jar to agent.jar, keep symbolic link for compatibility
This image does not clean up zombie processes. Zombie processes may appear when job fails.
The text was updated successfully, but these errors were encountered: