A recent update of Hudson, a great continuous integration engine, has fixed one bug, only to introduce a new one. On February 19th, 2009, Hudson bug #2729 (an issue about Hudson not cleaning up run-away processes after the build is complete) was fixed by Hudson now killing off all processes created by the build task, including intentionally spawned daemons or tasks you wanted to keep alive.

If, like me, you use an Ant task to start your application server using an exec task with the spawn set to true at the end of a Hudson build, this means that when you upgrade Hudson, your application server will stop starting, but the rest of your build will continue to work as expected.

The issue is captured in Hudson bug #3105. The work around is to set the BUILD_ID environment variable to “dontKillMe” for the process you wish to not be killed. The Hudson bug mentions solving this through setting the BUILD_ID via a build parameter, however that requires that you enter or accept the default parameter each time you want to run the build. Instead I simply added the environment variable to my exec task, like this:




You can now disable this process killing behavior globally by adding this to your JAVA_OPTS:

[plain] -Dhudson.util.ProcessTreeKiller.disable=true[/plain]