Bamboo is not able to stop a 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 will end after 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
Bamboo is not able to stop a build currently running in the build queue.
Any supported version of Bamboo.
When a user tries to stop a build from the UI, the action seems to do nothing. In the logs we will see a message similar to this one:
2022-06-21 06:28:46,560 INFO [http-nio-8080-exec-175] [DefaultStopBuildManager] : Request to stop 'PR-PL-JOB-1' 2022-06-21 06:28:46,560 INFO [http-nio-8080-exec-175] [DefaultStopBuildManager] Stopping build PR-PL-JOB-1 on agent 12341234 2022-06-21 06:28:46,564 INFO [http-nio-8080-exec-175] [ForceBuildStopper] Handling event com.atlassian.bamboo.event.BuildCanceledEvent[source=com.atlassian.bamboo.build.DefaultStopBuildManager@61d65d10] job=PR-PL-JOB #1 2022-06-21 06:28:46,568 ERROR [http-nio-8080-exec-175] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.event.BuildCanceledEvent[source=com.atlassian.bamboo.build.DefaultStopBuildManager@61d65d10] job=PR-PL-JOB #1] from the invoker [com.atlassian.event.internal.ComparableListenerInvoker@51981cd8] com.atlassian.bamboo.build.BuildDefinitionManager$BuildDefinitionNotFoundException: No plan exists for PR-PL-JOB at com.atlassian.bamboo.build.DefaultBuildDefinitionManagerTx.getNotNullPlanByKey(DefaultBuildDefinitionManagerTx.java:141) at com.atlassian.bamboo.build.DefaultBuildDefinitionManagerTx.getBuildDefinition(DefaultBuildDefinitionManagerTx.java:58) at sun.reflect.GeneratedMethodAccessor8159.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) (...)
The key clue of the error is "No plan exists for...". The reason why this happens is because the exact PROJECT-PLAN-JOB definition doesn't exist anymore in the DB. Possible reasons for this can be:
- The plan being moved from one project to another mid-execution.
- The job being deleted.
- The plan being deleted.
- Any other that would break the key "PR-PL-JOB"
At this point, the build queue is in an inconsistent state. The build on queue is now orphan and cannot be recovered.
Restarting Bamboo will empty the build queue, solving the problem.