Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What happens when bamboo stops a build?

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?

3 answers

1 accepted

1 vote
Answer accepted

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.

Thanks, Brent. This isn't quite what I'm looking for - I'd like to be able to handle the stopping case in my scripts, but this is the most helpful information I've found.

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:

#!/bin/sh
trap 'echo sigterm handler > /tmp/bamboo.log' TERM
sleep 100 &
wait

Note that your SIGTERM handler will actually have to kill your own child processes, which isn't always trivial on Linux.

After writing a script to trap the signal the following takes place when you stop the build in the middle of it running a script

"Broke n Pipe" 
$SIG{PIPE} 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

587 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you