Jenkins leaks processes when jobs are killed. I think this is related to this issue, so instead of creating a new bug report, I am adding this comment.

To reproduce the process leak, create a new freestyle job from a fresh install, and enter this script:

#!/usr/bin/python
import signal
import time
print "Main 1"
def handler(*ignored):
    print "Ignored 1"
    time.sleep(120)
    print "Ignored 2"

print "Main 2"
signal.signal(signal.SIGTERM, handler)
print "Main 3"
time.sleep(120)
print "Main 4"

Then execute the build, and after a few seconds once the build is running, hit the red [x] button to kill the job. After the job is killed and Jenkins is done, go to the terminal and look for the python process. You should find something like this:

$ ps -efH
...
mdanjou   2154  2150  0 08:22 pts/0    00:00:00     bash
mdanjou   2531  2154 16 08:24 pts/0    00:00:36       java -jar jenkins.war
mdanjou   2601  2531  0 08:25 pts/0    00:00:00         /usr/bin/python /tmp/hudson3048464595979281901.sh

The python script is still in memory, and still executing. However, Jenkins has cut the ties to the python script.

Jenkins must not cut the ties until the script is done.

In this comment, the script is a simple example, in real project scripts, the signal handler is used to clean up temporary files, and to terminate gracefully (e.g. killing other spawned processes).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to