Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
5.9.7
-
None
-
6
-
Severity 2 - Major
-
3
-
Description
Summary
Non-detached Docker containers started from Bamboo are not stopped if build was cancelled manually. These containers will continue running and consume CPU on the host.
Steps to Reproduce
- Configure build plan to start a Docker container
- Start the build
- When build is running, manually cancel the build using Actions >> Stop build
Expected Results
The task should end gracefully by cleaning up the non detached docker containers it has spun up
Actual Results
Docker containers started by the build will continue running in the background consuming CPU.
The below exception is thrown in the atlassian-bamboo.log file:
2016-05-11 13:27:34,864 INFO [13-BAM::Default Agent::Agent:pool-29-thread-1] [TaskResultBuilder] DOCK-TEST-JOB1-15: Failing task since return code of [/usr/local/bin/docker run --volume /Users/brosa/Documents/Atlassian/bamboo/bamboo-5.9.7/home/xml-data/build-dir/DOCK-TEST-JOB1:/data --workdir /data --rm brosadocker/customized-bamboo-java-agent:1.0.0] was 141 while expected 0 2016-05-11 13:27:34,865 INFO [13-BAM::Default Agent::Agent:pool-29-thread-1] [DefaultErrorHandler] Recording an error: Error occurred while running Task '(2)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli. : DOCK-TEST-JOB1 : Failed to execute task 2016-05-11 13:27:34,865 ERROR [13-BAM::Default Agent::Agent:pool-29-thread-1] [TaskExecutorImpl] Error occurred while running Task '(2)' of type com.atlassian.bamboo.plugins.bamboo-docker-plugin:task.docker.cli. com.atlassian.bamboo.task.TaskException: Failed to execute task at com.atlassian.bamboo.plugins.docker.service.RunService.execute(RunService.java:70) at com.atlassian.bamboo.plugins.docker.tasks.cli.DockerCliTask.execute(DockerCliTask.java:60) at com.atlassian.bamboo.task.TaskExecutorImpl$3.call(TaskExecutorImpl.java:288) at com.atlassian.bamboo.task.TaskExecutorImpl$3.call(TaskExecutorImpl.java:284) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:200) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:284) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:106) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:75) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:196) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:124) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:115) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:215) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:114) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:118) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.bamboo.plugins.docker.client.DockerException: Error running Docker run command at com.atlassian.bamboo.plugins.docker.client.DockerCmd.run(DockerCmd.java:103) at com.atlassian.bamboo.plugins.docker.service.RunService.execute(RunService.java:59) ... 18 more Caused by: com.atlassian.utils.process.ProcessException: Error executing /usr/local/bin/docker run --volume /Users/brosa/Documents/Atlassian/bamboo/bamboo-5.9.7/home/xml-data/build-dir/DOCK-TEST-JOB1:/data --workdir /data --rm brosadocker/customized-bamboo-java-agent:1.0.0 at com.atlassian.bamboo.plugins.docker.process.DockerTaskProcessService.execute(DockerTaskProcessService.java:60) at com.atlassian.bamboo.plugins.docker.client.DockerCmd.run(DockerCmd.java:99) ... 19 more
Workaround
If a build was stopped manually, the docker containers will need to be stopped manually.
Attachments
Issue Links
- is blocked by
-
BSP-50954 Loading...