Bamboo repository polling trigger does not start the build immediately

Still need help?

The Atlassian Community is here for you.

Ask the community


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

Summary

This article talks about one of the possible reasons why Bamboo builds configured with repository polling trigger might not start building immediately. 

The problem described on this article is for a main plan which has plan branches configured.

Environment

This has been tested in Bamboo 8.2.8 but the solution will be applicable for any supported version.

Diagnosis

The following actions can be taken to diagnose the issue and confirm that you're running into the problem described in this article:

  1. Manual builds are triggered immediately while automatic builds (configured with repository polling triggers) are not.
  2. There is a delay between the event change detection found changes for a plan and build dispatched event in the logs.
  3. Issue happens with specific plans while other plans has no delay. The plan with issue has plan branches configured which utilises the same trigger as main branch.
  4. Time taken for the build to get triggered exceeds the polling frequency of repository polling trigger.
  5. The <bamboo-home>/logs/atlassian-bamboo.log files report that Did not start queue polling job, CHAIN:<Plan_Key> is already being executed. Here's an example of what to look for in the application logs:

    NOTE

    Below logs are shown only after enabling additional DEBUG classes. To enable debug for these classes navigate to Bamboo Administration >> Log Settings >> in the Classpath feild enter classpath name ex: com.atlassian.bamboo.repository.svn select type as "DEBUG" and click on ADD . Add the other classes listed below.

    • com.atlassian.bamboo.repository DEBUG
    • com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager DEBUG
    • com.atlassian.bamboo.build.strategy DEBUG
    • com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl ALL
    • com.atlassian.bamboo.plan.PlanExecutionManagerImpl All
    • com.atlassian.bamboo.v2.build.queue.BuildQueueManagerImpl DEBUG
    • com.atlassian.bamboo.chains.ChainExecutionManagerImpl DEBUG
2023-06-23 08:37:29,661 DEBUG [10-BAM::PlanExec:pool-13-thread-1] [DefaultChangeDetectionManager] Change detection for repository "testXpert R Monorepo" in plan "TR-TRP" took 357.9 ms
2023-06-23 08:37:29,662 DEBUG [10-BAM::PlanExec:pool-13-thread-1] [DefaultChangeDetectionManager] Collecting changes for plan: TR-TRP
2023-06-23 08:37:29,909 DEBUG [10-BAM::PlanExec:pool-13-thread-1] [DefaultChangeDetectionManager] Change detection for plan TR-TRP took 608.3 ms
2023-06-23 08:37:29,909 INFO [10-BAM::PlanExec:pool-13-thread-1] [ChangeDetectionListenerAction] : Change detection found 1 change for plan TR-TRP
2023-06-23 08:40:27,471 TRACE [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-20] [NonBlockingPlanExecutionServiceImpl] Enqueueing CHAIN:TR-TRP for execution, trigger id: 1
2023-06-23 08:40:27,471 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-20] [NonBlockingPlanExecutionServiceImpl] Did not start queue polling job, CHAIN:TR-TRP is already being executed
2023-06-23 08:42:33,598 DEBUG [10-BAM::PlanExec:pool-13-thread-1] [ChainExecutionManagerImpl] registerChainStateReference TR-TRP-4577
2023-06-23 08:42:33,656 INFO [10-BAM::PlanExec:pool-13-thread-1] [ChainExecutionManagerImpl] Build TR-TRP-CP-4577 has been dispatched

Cause

The plan branch configured with the same repository polling trigger keeps the thread(NonBlockingPlanExecutionServiceImpl) busy and is possible reason for the block. The thread is utilised for the queue polling job for the plan which delays the build dispatch for the main branch. Here's an example of what to look in the application logs to confirm this:

2023-06-23 08:40:27,459 DEBUG [AtlassianEvent::0-BAM::EVENTS:pool-2-thread-31] [NonBlockingPlanExecutionServiceImpl] Starting queue polling job to handle execution of CHAIN:TR-TRP126


Solution

Create a separate repository polling trigger for the plan branch which keeps the thread busy. To create a separate trigger for the plan branch:

  1. Navigate to Build >> All Build Plans
  2. Select the plan which which has the issue.
  3. Click on the drop down Plan Branch and select the plan branch.
  4. Click on Action >> Configure Branch
  5. Check the Change Trigger option
  6. Create a separate polling trigger for the plan branch.


Last modified on Nov 21, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.