Build fails with 'cannot find current thread' error

Article ID:360033606192
1 minute readKnowledge base

Issue

Builds sometimes fail with the error:

java.io.IOException: cannot find current thread
at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:300)
at org.jenkinsci.plugins.workflow.cps.CpsBodySubContext.doGet(CpsBodySubContext.java:88)
at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:67)
at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Callback.finished(BindingStep.java:254)
at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution2$Callback2.finished(BindingStep.java:162)
at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution$TailCall.lambda$onSuccess$0(GeneralNonBlockingStepExecution.java:140)
at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Resolution

This is a bug that was reported here: [JENKINS-56890] IOException: "cannot find current thread" - Jenkins JIRA It affects environments with Jenkins versions above 2.164 and Pipeline: Groovy (workflow-cps) plugin below version 2.69

The solution is to upgrade the Pipeline: Groovy (workflow-cps) plugin to version 2.69 or higher

Please upgrade your CloudBees CI instance to version 2.176.2.3 or higher as the updated plugin is included in these versions of CAP.