-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
None
-
Docker 18.06.1-ce, MacOS and Linux
Jenkins 2.141
Docker plugin 1.1.5
In a Jenkins environment which has one Docker agent template defined, create two simple Pipeline jobs which will both use that template. One job will run an 'echo' step and exit quickly, the other will sleep for 60 seconds. If you trigger these two jobs simultaneously, the short-running one will finish successfully and its container will then be stopped. When that happens, the remoting connection to the remaining job gets disrupted. It throws this exception in its console log:
Cannot contact dockeragent-0002sinrcnyoa: hudson.remoting.ChannelClosedException: Channel "unknown": Remote call on dockeragent-0002sinrcnyoa failed. The channel is closing down or has closed down
And at this point the job is hung and must be manually aborted. The workaround for this problem is either to put a five second sleep in between triggering the two jobs, or to create an additional Docker agent template with a different label, and configure each job to use a separate label.
I'm not sure if the problem here is with the Docker plugin or with Remoting.
Attached is a complete log from the Jenkins service, from the time the two jobs were triggered. The 'SEVERE: Error during callback' errors happened while the broken job was still trying to run before it was aborted.
This is probably because docker containers are specifically designed to do one and only one job and then be destroyed. If you're having more than one bit of work run on a container then that's not going to go well - you need to ensure that your pipeline code takes over one node exclusively and uses it exclusively until it's done with it - no sharing.
If you've got multiple pipelines all after the same template then Jenkins should spin up multiple containers for that workload - we shouldn't have any jobs sharing containers...
I'm sorry I don't have a specific answer for this one - if it's still an problem with the latest release then please do see what else you can find out; of not, please close the issue.