-
Bug
-
Resolution: Incomplete
-
Critical
-
-
workflow-cps 2.69
Our server has intermittently been raising an exception which fails builds:
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)
Finished: FAILURE
It happens across different projects, and we can't find any commonality between them that might explain how we're ending up in this state. The error is not repeatable – kicking off the build again usually results in a successful build.
(Relevant?) plugin versions:
Pipeline Multibranch: 2.20
Pipeline: Groovy 2.63
I found the line that is throwing the exception in the source code, which seems straightforward, but I don't know why that value is sometimes null.
I'm happy to provide more information to help diagnose this problem if you need something more.
[JENKINS-56890] IOException: "cannot find current thread"
Description |
Original:
Our server has intermittently been raising an exception which fails builds: {{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)}} {{Finished: FAILURE}} It happens across different projects, and we can't find any commonality between them that might explain how we're ending up in this state. The error is not repeatable – kicking off the build again usually results in a successful build. [Jenkins ver. 2.164.1|https://jenkins.io/] (Relevant?) plugin versions: Pipeline Multibranch: 2.20 Pipeline: Groovy 2.63 I found [the line that is throwing the exception in the source code|[https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsStepContext.java#L300]], which seems straightforward, but I don't know why that value is sometimes null. I'm happy to provide more information to help diagnose this problem if you need something more. |
New:
Our server has intermittently been raising an exception which fails builds: {{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)}} {{Finished: FAILURE}} It happens across different projects, and we can't find any commonality between them that might explain how we're ending up in this state. The error is not repeatable – kicking off the build again usually results in a successful build. [Jenkins ver. 2.164.1|https://jenkins.io/] (Relevant?) plugin versions: Pipeline Multibranch: 2.20 Pipeline: Groovy 2.63 I found [the line that is throwing the exception in the source code|https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsStepContext.java#L300], which seems straightforward, but I don't know why that value is sometimes null. I'm happy to provide more information to help diagnose this problem if you need something more. |
We enabled logging for the CpsStepContext class and got some interesting results:
In both cases, the thread IDs being looked up do exist in the `threads` TreeSet, but their value is null? But I don't see anywhere where a null value gets inserted into that TreeSet. Could this be a race condition, accessing that value as it's being added/removed by another thread?