Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-75085

Cannot contact agent-1: java.io.IOException: cannot find current thread

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • workflow-cps-plugin

      We have upgraded to the jenkins version 2.479.1 and the mentioned plugin versions at 20th November 2024.
      Since last Xmas we are facing (or did we just recognize it a month later?) that our pipeline runs are failing after successful build in the deploy to cloud foundry stage. An exemplary log follows:

      [2025-01-03T07:06:25.296Z] info  cloudFoundryDeploy - Staging application "cp-not-db"...
      [2025-01-03T07:07:21.477Z] info  cloudFoundryDeploy - Executing task "deploy" on application "cp-not-db"...
      [2025-01-03T07:07:21.477Z] Cannot contact agent-1: java.io.IOException: cannot find current thread 

      I have rated the priority to critical, because we are not able to get a complete successful run.

        1. plugins.txt
          6 kB
        2. run-jenkins.sh
          1 kB
        3. plugin_versions.txt
          6 kB

          [JENKINS-75085] Cannot contact agent-1: java.io.IOException: cannot find current thread

          Mark Waite added a comment - - edited

          I'm not able to duplicate the failure as reported. Others will likely have the same issue because there is not enough information in the report so that others can duplicate the issue from a fresh Jenkins installation. Here are the steps that I took while trying to duplicate the issue:

          1. Create a plugins.txt file that lists the installed plugins and their versions (without the nexus-jenkins-plugin, since it is a proprietary plugin that is no longer distributed by the Jenkins update center)
          2. Create a run-jenkins.sh shell script that downloads the proprietary nexus-jenkins-plugin, uses the plugin installation manager tool to download the other plugins, and downloads Jenkins 2.479.1
          3. Run the run-jenkins.sh shell script and complete the setup wizard by creating a new user and installing no additional plugins
          4. Define an inbound agent and connect that inbound agent
          5. Adjust the number of executors on the Jenkins controller to 0 so that the inbound agent will be used for all jobs
          6. Create a "Hello world" Pipeline job and confirm that it runs on the agent
          7. Add a Pipeline step to the "Hello world" job based on the first example in the Sonatype documentation and confirm that it fails because I do not have a Cloud Foundry installation
          8. Create a Freestyle project and add a "Push to cloud foundry" build step that uses Cl, confirm that it fails because I don't have access to a Cloud Foundry installation

          If there are other maintainers that have access to a Cloud Foundry installation, they might be able to make more progress than I made. More detailed steps that allow others to duplicate the issue will probably be appreciated by others.

          Mark Waite added a comment - - edited I'm not able to duplicate the failure as reported. Others will likely have the same issue because there is not enough information in the report so that others can duplicate the issue from a fresh Jenkins installation. Here are the steps that I took while trying to duplicate the issue: Create a plugins.txt file that lists the installed plugins and their versions (without the nexus-jenkins-plugin, since it is a proprietary plugin that is no longer distributed by the Jenkins update center) Create a run-jenkins.sh shell script that downloads the proprietary nexus-jenkins-plugin , uses the plugin installation manager tool to download the other plugins, and downloads Jenkins 2.479.1 Run the run-jenkins.sh shell script and complete the setup wizard by creating a new user and installing no additional plugins Define an inbound agent and connect that inbound agent Adjust the number of executors on the Jenkins controller to 0 so that the inbound agent will be used for all jobs Create a "Hello world" Pipeline job and confirm that it runs on the agent Add a Pipeline step to the "Hello world" job based on the first example in the Sonatype documentation and confirm that it fails because I do not have a Cloud Foundry installation Create a Freestyle project and add a "Push to cloud foundry" build step that uses Cl, confirm that it fails because I don't have access to a Cloud Foundry installation If there are other maintainers that have access to a Cloud Foundry installation, they might be able to make more progress than I made. More detailed steps that allow others to duplicate the issue will probably be appreciated by others.

          Mark Waite added a comment -

          There are other reports of a similar message, but those reports do not included detailed steps that will allow others to duplicate the issue. There are also suggestions that the symptom "cannot find current thread" may occur for many different reasons. Some of the issues that refer to that message include:

          Mark Waite added a comment - There are other reports of a similar message, but those reports do not included detailed steps that will allow others to duplicate the issue. There are also suggestions that the symptom "cannot find current thread" may occur for many different reasons. Some of the issues that refer to that message include: JENKINS-56890 JENKINS-70993 JENKINS-73336 JENKINS-75062

          Markus added a comment -

          it showed that the misbehavior of agent-1 was somehow caused by agent-2. i did take agent-2 offline and did no longer face this issue.

          Markus added a comment - it showed that the misbehavior of agent-1 was somehow caused by agent-2. i did take agent-2 offline and did no longer face this issue.

          Philippe added a comment - - edited

          Issue reopened. We are still facing this issue. See the initially posted version of Jenkins and plugins.

          We have two nodes connected to our Jenkins. Jenkins is running inside a docker container as well do the SSH agents.

          If we only have node-1 online everything is working fine. If we bring back node-2 online, then we are facing above error with following exception:

          java.io.IOException: cannot find current thread
          	at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:295)
          	at PluginClassLoader for workflow-support//org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
          	at PluginClassLoader for workflow-durable-task-step//org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.launcher(DurableTaskStep.java:491)
          	at PluginClassLoader for workflow-durable-task-step//org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:608)
          	at PluginClassLoader for workflow-durable-task-step//org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:556)
          	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
          	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
          	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
          	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
          	at java.base/java.lang.Thread.run(Thread.java:833) 

          Philippe added a comment - - edited Issue reopened. We are still facing this issue. See the initially posted version of Jenkins and plugins. We have two nodes connected to our Jenkins. Jenkins is running inside a docker container as well do the SSH agents. If we only have node-1 online everything is working fine. If we bring back node-2 online, then we are facing above error with following exception: java.io.IOException: cannot find current thread at PluginClassLoader for workflow-cps //org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:295) at PluginClassLoader for workflow-support //org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75) at PluginClassLoader for workflow-durable-task-step //org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.launcher(DurableTaskStep.java:491) at PluginClassLoader for workflow-durable-task-step //org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:608) at PluginClassLoader for workflow-durable-task-step //org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:556) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang. Thread .run( Thread .java:833)

          Andrea added a comment - - edited

          Hello, 
          it's a couple of days that one of our node give a very similar error within 10 minutes from the start of any Job.

          Cannot contact main-node: java.io.IOException: cannot find current thread
          

          The problem start happening after we did a plugin update (there was a few).
          plugin_versions.txt
          The issue can happens in very different scenarios: when cloning a repo with git, when running a bash script, a python script: we don't see any relationship between the operation run and the issue.

          This node runs on the same machine as the Jenkins instance and it's an Ubuntu 22.04.

          Another node running on another machine on Ubuntu 20.04 doesn't have the issue.

          Jenkins version is 2.479.3 but was happening also with 2.479.2.
          We have recreated the node from scratch but it's still happening.

          Andrea added a comment - - edited Hello,  it's a couple of days that one of our node give a very similar error within 10 minutes from the start of any Job. Cannot contact main-node: java.io.IOException: cannot find current thread The problem start happening after we did a plugin update (there was a few). plugin_versions.txt The issue can happens in very different scenarios: when cloning a repo with git, when running a bash script, a python script: we don't see any relationship between the operation run and the issue. This node runs on the same machine as the Jenkins instance and it's an Ubuntu 22.04. Another node running on another machine on Ubuntu 20.04 doesn't have the issue. Jenkins version is 2.479.3 but was happening also with 2.479.2. We have recreated the node from scratch but it's still happening.

          Markus added a comment -

          Hi andrea_albano,

          thank you for adding this. This exactly matches our observations on this issue.

          Markus added a comment - Hi andrea_albano , thank you for adding this. This exactly matches our observations on this issue.

          Philippe added a comment -

          Good point. Jenkins master and the nodes are running SLES 15 SP2. OS Patch level for the nodes should be the same. Each of them running on an own machine inside a docker container.

          markewaite Issue was reopened yesterday.

          Philippe added a comment - Good point. Jenkins master and the nodes are running SLES 15 SP2. OS Patch level for the nodes should be the same. Each of them running on an own machine inside a docker container. markewaite Issue was reopened yesterday.

          David added a comment -

          I'm currently facing the same scenario with same Jenkins version 2.479.1. Jenkins together with plugins was also upgraded in November 2024. Running on Windows Server 2022, pipeline running on built-in node.

          Cannot contact : java.io.IOException: cannot find current threadAgent was removed
          org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 422deb70-d017-4614-85b1-69ce267df93c
          Finished: ABORTED

          David added a comment - I'm currently facing the same scenario with same Jenkins version 2.479.1. Jenkins together with plugins was also upgraded in November 2024. Running on Windows Server 2022, pipeline running on built-in node. Cannot contact : java.io.IOException: cannot find current threadAgent was removed org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 422deb70-d017-4614-85b1-69ce267df93c Finished: ABORTED

          Andrea added a comment -

          A little update: today we have tried to enable the built-in node and it is working.

          The built-in node runs on the same machine as the node that has the issue, so we are a little more confused.

          Andrea added a comment - A little update: today we have tried to enable the built-in node and it is working. The built-in node runs on the same machine as the node that has the issue, so we are a little more confused.

          David added a comment -

          Little update here also: After restarting the host, the pipeline executed successfully 2 times (it is scheduled).

          David added a comment - Little update here also: After restarting the host, the pipeline executed successfully 2 times (it is scheduled).

          Philippe added a comment -

          Update from our end, too: After restarting Jenkins master instance everything seems to be running smoothly again. But we still have no clue where or this error was appearing...

          Philippe added a comment - Update from our end, too: After restarting Jenkins master instance everything seems to be running smoothly again. But we still have no clue where or this error was appearing...

          David added a comment -

          This error appeared again after a month, restarting the Jenkins instance solved the issue once again.

          David added a comment - This error appeared again after a month, restarting the Jenkins instance solved the issue once again.

          Vladimir added a comment - - edited

          We found a really strange workaround for that, but maybe it will help someone

          Jenkins 2.496, latest plugins.

          In our Jenkins it only appeared on one agent - "***-win-10" to be precisely. We recreated VM with agent, Jenkins node on Jenkins, upgraded plugins and jenkins itself but nothing helped.

          But somehow recreating Jenkins agent node for the same server as "***-win-11" somehow fixed the problem.

          Vladimir added a comment - - edited We found a really strange workaround for that, but maybe it will help someone Jenkins 2.496, latest plugins. In our Jenkins it only appeared on one agent - "***-win-10" to be precisely. We recreated VM with agent, Jenkins node on Jenkins, upgraded plugins and jenkins itself but nothing helped. But somehow recreating Jenkins agent node for the same server as "***-win-11" somehow fixed the problem.

            Unassigned Unassigned
            markus_lanz Markus
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: