Delay between Bitbucket Server commit and Bamboo build
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
If you have Builds and Branches triggered by repositories, they may be delayed with no error showing in the logs.
Diagnosis
Diagnostic Steps
- Add DEBUG logging for the following classpaths, from
Administration >> Overview >> Log settings
:com.atlassian.bamboo.plugins.stash.events.BranchChangedEventListener
com.atlassian.bamboo.plan.PlanExecutionManagerImpl
com.atlassian.bamboo.chains.ChainExecutionManagerImpl
Check the timestamps from the Commit to Change Detection, for example:
2017-01-19 13:09:49,777 INFO [http-nio-8085-exec-384] [AuthenticatorImpl] Authenticated app 'Stash:#######' as user 'null' successfully 2017-01-19 13:09:49,777 INFO [http-nio-8085-exec-384] [AccessLogFilter] 127.0.0.1 POST <bamboo-url>/rest/remote-event-consumer/latest/events/stash-branch-changed-remote-event 2794562kb 2017-01-19 13:09:49,778 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-6] [BranchChangedEventListener] Received stash ref changed event [ <branch>, master] 2017-01-19 13:09:49,781 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-6] [BranchChangedEventListener] publishing change detection event for <plan-key> ... 2017-01-19 13:27:53,593 DEBUG [9-BAM::PlanExec:pool-16-thread-1] [PlanExecutionManagerImpl] Plan: <plan-key> about to run change detection for <plan-key> on repositories [107282444] 2017-01-19 13:27:54,502 INFO [9-BAM::PlanExec:pool-16-thread-1] [GitCommandProcessor] from revision: [<commit-hash>]; to revision: [<commit-hash>]
Cause
This can be caused by other triggers existing on builds. Specifically, having the Repository polling trigger on Plans and Branches can add significant time because it will run once for each plan and branch for every plan and branch which has it configured.
Resolution
Please avoid using the Repository polling trigger if you use other triggers.