Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Timeouts in steps and canceling the build #42

SameOldSong ·

We have a step "Execute Script" which executes a groovy script. The step has timeout = 120 (seconds).
In the script there is a loop waiting for an event, which unfortunately never occurs due to an error in the script.
Setting timeout in the step was supposed to be a failsafe measure for exactly this kind of error.

As of now, the step has been running for half an hour. The timout seems to have no effect. I've tried to cancel the build several times - no effect either.

Also, I noticed in Advanced settings of the build that Force Kill Timeout is inherited from parent configuration as 5 (don't know whether 5 seconds or minutes or hours, since there is no mentioning of units in the help text).
Is this setting actually supposed to kill the running build 5 after I cancelled it?

  • replies 4
  • views 3066
  • stars 0
robinshen ADMIN ·

QB cancels the step by interrupting the thread. If you are simply calling sleep in groovy loop, it will not respond to thread interrupting. Instead, try Thread.sleep, for instance:

while (event not happening) {
Thread.sleep(1000)
}

The "force kill timeout" is in seconds. The inline help will be improved to emphasize this.

SameOldSong ·

Thank you for the prompt response.

So do I understand it right that if I use "sleep" in a groovy script and the script runs forever, then absolutely nothing can stop this step (other than restarting the agent or the server)?

By "nothing" I mean none of these ways to stop the step/build:

  • timeout in the step
  • timeout in the parent step
  • build timeout
  • cancelling the build manually
robinshen ADMIN ·

Yes this is true.

SameOldSong ·

Thank you for the explanation