On linux one step of my build runs a bash script which in turn spawns a number of other processes. When the build is stopped in bamboo, I see that some of the processes continue to run on the build agent.
I assume that I need to clean up my processes when the build is being stopped, but I don't know exactly what happens when the stop occurs. How does bamboo implement the task stopping? Does it send the child process a signal? If so, which signal is it?
I don't know the exact mechanisms Bamboo uses when you stop a build, but we had to workaround the orphan process problem by creating an "orphan killer" daemon on the machine that periodically looked for Bamboo-owned processes with a parent PID of 1.
There is a "Hung Build Killer" plugin for Bamboo. I've never used it, but you may be able to peak at the source to get an idea of how it handles the orphaned processes.
Bamboo sends SIGTERM to the script.
Tested with Bamboo 6.4.1 on Linux, by creating the following script, running a build, then stopping it:
trap 'echo sigterm handler > /tmp/bamboo.log' TERM
sleep 100 &
Note that your SIGTERM handler will actually have to kill your own child processes, which isn't always trivial on Linux.
Hey there, Data Center community! I'm Martyna Wojtas and I am the Product Manager for Bamboo Data Center. I’m excited to share that Bamboo 9.0 is now available. We purpose-built this platform to help...