BUILDENG-2873: Use a while loop instead of recursive polling

#1 Declined
Deleted repository
master (4ad069ab04fa)
  1. Min'an Tan
No description
  • Dependencies Checking for dependencies...
  • Dependents Checking for dependents...

Comments (5)

  1. Joseph Clark

    I'm not sure this is a good solution. At least in the previous code, the recursive solution had a failure case where the task would fail and execution would cease (even if it was indeterminate). Now, theoretically, the task could run forever and never finish if the remote server does not return an expected response.

    You can see in the problematic bamboo build that a successful build ( usually only takes a minute, but the recent failure took over 8 minutes before the JVM stack was exhausted (

    I think if you swap to a while loop, there should be a timeout at which point the loop execution is terminated.

  2. Joseph Clark

    Confluence and JIRA generally give plugins a grace period of 60 seconds to finish enabling. I think 1-2 minutes for the task timeout would be appropriate. I can implement this if you are stretched for time; just let me know.

  3. Min'an Tan author

    Are you referring to the 400? As far as I can tell, the failure case is still in place because the TaskException would still be thrown in the loop if it got a 400.

    Fair call for the timeout, though I will leave it in your hands if you want to go down that path :)

  4. Joseph Clark

    I'm saying that you probably can't guarantee that the remote server will ever return a HTTP error code. It may continue to perpetually return HTTP 200 OK responses to indicate that the plugin is still "installing". This seems to be what was happening in the current failing build - the remote server spent 8 minutes telling the client to keep polling before the task overflowed the stack.

    I'll add in a timeout, then commit and release.