Skip to content

[JENKINS-46507] Parallel Pipeline random java.lang.InterruptedException #1355

Closed

Description

@jenkins-infra-bot

In my pipeline job,
sometimes it'd randomly receive the java.lang.InterruptedException below:

java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
	at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:275)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:248)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:237)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:294)
	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:251)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:179)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.println(CpsScript.java:207)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.print(CpsScript.java:202)
	at sun.reflect.GeneratedMethodAccessor103253.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
....
....

Please refer to the file attachment for the full console log and the pipeline Jenkinsfile code.


Originally reported by totoroliu, imported from: Parallel Pipeline random java.lang.InterruptedException
  • assignee: dnusbaum
  • status: Resolved
  • priority: Major
  • component(s): pipeline, workflow-cps-plugin
  • resolution: Fixed
  • resolved: 2019-01-31T21:32:26+00:00
  • votes: 19
  • watchers: 30
  • imported: 2025-12-07
Raw content of original issue

In my pipeline job, sometimes it'd randomly receive the java.lang.InterruptedException below:

java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
	at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:275)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:248)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:237)
	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:294)
	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:251)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:179)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.println(CpsScript.java:207)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.print(CpsScript.java:202)
	at sun.reflect.GeneratedMethodAccessor103253.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
....
....

Please refer to the file attachment for the full console log and the pipeline Jenkinsfile code.

environment
Ubuntu 14.04.5 LTS<br/>
openjdk version &quot;1.8.0_111&quot;<br/>
Jenkins ver. 2.46.1<br/>
Pipeline: API ver. 2.12<br/>
Pipeline: Basic Steps ver. 2.4<br/>
Pipeline: Build Step ver. 2.4<br/>
Pipeline: Groovy ver. 2.29<br/>
Lockable Resources plugin ver. 1.11.2
7 attachments

Activity

  1. jenkins-infra-bot commented on Aug 28, 2017

    @jenkins-infra-bot
    Author
  2. jenkins-infra-bot commented on Aug 28, 2017

    @jenkins-infra-bot
    Author
    abayer:

    svanoort - may be of interest to you.

  3. jenkins-infra-bot commented on Sep 28, 2017

    @jenkins-infra-bot
    Author
    carbon:
    • Original comment link
    • Raw content of original comment:

      +1 to this issue. Experiencing a hang followed by this error when large amount of pipelines run concurrently

    +1 to this issue. Experiencing a hang followed by this error when large amount of pipelines run concurrently

  4. jenkins-infra-bot commented on Oct 24, 2017

    @jenkins-infra-bot
    Author
    abeeskau:
    • Original comment link
    • Raw content of original comment:

      +1 we're experiencing this as well.

    +1 we're experiencing this as well.

  5. jenkins-infra-bot commented on Dec 8, 2017

    @jenkins-infra-bot
    Author
    syedimran89:
    • Original comment link
    • Raw content of original comment:

      +1 we're experiencing this as well. expecting a resolution

    +1 we're experiencing this as well. expecting a resolution

  6. jenkins-infra-bot commented on Jan 11, 2018

    @jenkins-infra-bot
    Author
    ghenzler:
    • Original comment link
    • Raw content of original comment:

      +1 we're experiencing this as well.

    +1 we're experiencing this as well.

  7. jenkins-infra-bot commented on Jan 16, 2018

    @jenkins-infra-bot
    Author
    suriyanath:
    • Original comment link
    • Raw content of original comment:

      We are also experiencing the same, on jenkins version 2.69

    We are also experiencing the same, on jenkins version 2.69

  8. jenkins-infra-bot commented on Jan 29, 2018

    @jenkins-infra-bot
    Author
    lorenzo_cubero:
    • Original comment link
    • Raw content of original comment:

      Same here using Jenkins 2.73.2

    Same here using Jenkins 2.73.2

  9. jenkins-infra-bot commented on Feb 8, 2018

    @jenkins-infra-bot
    Author
    singhshyam:
    • Original comment link
    • Raw content of original comment:

      +1 Same here, we are facing this issue very frequently

    +1 Same here, we are facing this issue very frequently

  10. jenkins-infra-bot commented on Apr 11, 2018

    @jenkins-infra-bot
    Author
    bksoux:
    • Original comment link
    • Raw content of original comment:

      +1 same here

    +1 same here

  11. jenkins-infra-bot commented on Apr 18, 2018

    @jenkins-infra-bot
    Author
    architeuthis:
    • Original comment link
    • Raw content of original comment:

      +1 Same here

    +1 Same here

  12. jenkins-infra-bot commented on Apr 18, 2018

    @jenkins-infra-bot
    Author
    ghenzler:

    We also had this problem again today... reading jglick's comment in https://issues.jenkins-ci.org/browse/JENKINS-35710?focusedCommentId=268398&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-268398 I suspect adding more slaves does not help (as the stacktrace clearly points to CPS, and according the comment that always runs on master)... but I suppose using https://github.com/jenkinsci/throttle-concurrent-builds-plugin to ensure only a maximum of builds run in parallel globally could help. svanoort before trying, do you think this is a valid way of getting rid of the problem? (asking before trying as this is not easy to reproduce)

  13. jenkins-infra-bot commented on Apr 18, 2018

    @jenkins-infra-bot
    Author
    svanoort:
    • Original comment link
    • Raw content of original comment:

      ghenzler Executors have nothing to do with this, and this issue is generally within the scope of a single build, so limiting the maximum number should have no impact – except when restarting Jenkins, where there might be enough of a bottleneck due to loading FlowExecutions to hit the 1 minute timeout. Maybe if you had maybe 10x as many Pipelines as CPU cores on the master, or really complex Program state – in this case we'd be blocking on the code here: https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L1024

      Do you have a message like this in your logs? WARNING, failed to wait for $someRun to be loaded (and then a stack trace).

      More likely there's something subtly wrong with the concurrency/error-handling model here – some of what I'm doing right now to untangle some nasty issues in these guts may help – and there was a change in the last release of workflow-cps that might help if you don't have it already (it caught more exceptions and prevented threads from potentially waiting forever).

    ghenzler Executors have nothing to do with this, and this issue is generally within the scope of a single build, so limiting the maximum number should have no impact – except when restarting Jenkins, where there might be enough of a bottleneck due to loading FlowExecutions to hit the 1 minute timeout. Maybe if you had maybe 10x as many Pipelines as CPU cores on the master, or really complex Program state – in this case we'd be blocking on the code here: https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L1024

    Do you have a message like this in your logs? WARNING, failed to wait for $someRun to be loaded (and then a stack trace).

    More likely there's something subtly wrong with the concurrency/error-handling model here – some of what I'm doing right now to untangle some nasty issues in these guts may help – and there was a change in the last release of workflow-cps that might help if you don't have it already (it caught more exceptions and prevented threads from potentially waiting forever).

  14. jenkins-infra-bot commented on Sep 4, 2018

    @jenkins-infra-bot
    Author
    iceiceice:
    • Original comment link
    • Raw content of original comment:

      Same here. I'm running a @NonCPS labeled method in library and if fails with this error randomly in the middle

      import jenkins.*
      import jenkins.model.*
      import hudson.*
      import hudson.model.*
      
      /* This method will find all jobs and verify their disk usage.
      Then it will remove job runs to fit  quota
      
      That will help to save disk space
      
      */
      @NonCPS
      def call() {
          def maxRunSize = 21474836480 //20Gb
          def maxJobSize = 42949672960 //40Gb
          Jenkins.instance.getAllItems(hudson.model.Job).each
                  {
                      println it
                      def runs = it.getBuilds()
                      def job = it
                      def totalSize = 0
                      def jobSizeReached = false
                      runs.each{
                          def currentRun = it
                          def currentRunSize = it.getRootDir().directorySize()
                          println it
                          println currentRunSize
                          switch (currentRunSize) {
                              case {it > maxRunSize} :
                                  currentRun.delete()
                                  println "deleted " + currentRun + " for having size " + it + " over allowed " +  maxRunSize
                                  break
                              case {it + totalSize > maxJobSize || jobSizeReached } :
                                  jobSizeReached = true
                                  currentRun.delete()
                                  println "deleted " + currentRun + " for not fitting total  " + job + " jobs size " + (totalSize+currentRunSize) +" to max  allowed " +  maxJobSize
                                  break
                              default :
                                  totalSize += currentRunSize
                                  println 'leaving '  + currentRun + ". current total = " + totalSize
                                  break
                          }
                          println '--------------------------'
                      }
                      println '=========================='
                  }
      }
      
      
      <<Some output from the loop here sometime few lines sometime few hundred lines, i guess it fails after some random number>>
      --------------------------
      [Pipeline] echo
      [Pipeline] End of Pipeline
      java.lang.InterruptedException
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
      	at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:275)
      	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111)
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:248)
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:237)
      	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:298)
      	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
      	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:258)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:206)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.println(CpsScript.java:221)
      	at sun.reflect.GeneratedMethodAccessor1023.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:925)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:908)
      	at org.codehaus.groovy.runtime.DefaultGroovyMethods.println(DefaultGroovyMethods.java:678)
      	at org.codehaus.groovy.runtime.dgm$500.doMethodInvoke(Unknown Source)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
      

      jenkins 2.107.3

    Same here. I'm running a @​NonCPS labeled method in library and if fails with this error randomly in the middle

    import jenkins.*
    import jenkins.model.*
    import hudson.*
    import hudson.model.*
    
    /* This method will find all jobs and verify their disk usage.
    Then it will remove job runs to fit  quota
    
    That will help to save disk space
    
    */
    @​NonCPS
    def call() {
        def maxRunSize = 21474836480 //20Gb
        def maxJobSize = 42949672960 //40Gb
        Jenkins.instance.getAllItems(hudson.model.Job).each
        {
    println it
    def runs = it.getBuilds()
    def job = it
    def totalSize = 0
    def jobSizeReached = false
    runs.each{
        def currentRun = it
        def currentRunSize = it.getRootDir().directorySize()
        println it
        println currentRunSize
        switch (currentRunSize) {
    case {it > maxRunSize} :
        currentRun.delete()
        println "deleted " + currentRun + " for having size " + it + " over allowed " +  maxRunSize
        break
    case {it + totalSize > maxJobSize || jobSizeReached } :
        jobSizeReached = true
        currentRun.delete()
        println "deleted " + currentRun + " for not fitting total  " + job + " jobs size " + (totalSize+currentRunSize) +" to max  allowed " +  maxJobSize
        break
    default :
        totalSize += currentRunSize
        println 'leaving '  + currentRun + ". current total = " + totalSize
        break
        }
        println '--------------------------'
    }
    println '=========================='
        }
    }
    
    
    
    <<Some output from the loop here sometime few lines sometime few hundred lines, i guess it fails after some random number>>
    --------------------------
    [Pipeline] echo
    [Pipeline] End of Pipeline
    java.lang.InterruptedException
    	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
    	at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:275)
    	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111)
    	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:248)
    	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:237)
    	at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:298)
    	at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:61)
    	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:258)
    	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:206)
    	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
    	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
    	at org.jenkinsci.plugins.workflow.cps.CpsScript.println(CpsScript.java:221)
    	at sun.reflect.GeneratedMethodAccessor1023.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
    	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:925)
    	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:908)
    	at org.codehaus.groovy.runtime.DefaultGroovyMethods.println(DefaultGroovyMethods.java:678)
    	at org.codehaus.groovy.runtime.dgm$500.doMethodInvoke(Unknown Source)
    	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
    	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
    	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
    
    

    jenkins 2.107.3

  15. jenkins-infra-bot commented on Sep 5, 2018

    @jenkins-infra-bot
    Author
    tobybro:
    • Original comment link
    • Raw content of original comment:

      We are seeing this error quite often lately. Is there anything I can do to help troubleshoot?

    We are seeing this error quite often lately. Is there anything I can do to help troubleshoot?

  16. 31 remaining items

  17. jenkins-infra-bot commented on Jan 14, 2019

    @jenkins-infra-bot
    Author
    dnusbaum:

    ncrmnt did those timeouts end up helping? If so, I can roll them up into jenkinsci/workflow-durable-task-step-plugin#90 and release that so they can be configured without needing to run custom code.

  18. jenkins-infra-bot commented on Jan 15, 2019

    @jenkins-infra-bot
    Author
    ncrmnt:
    • Original comment link
    • Raw content of original comment:

      dnusbaum Sorry for not reporting earlier. 60 seconds seem to have fixed all issues for me. The rest of the problems were due to ctest (and our numa scheduler wrapped within it before the actual simulator) not correctly dying when jenkins asked them to do so.

    dnusbaum Sorry for not reporting earlier. 60 seconds seem to have fixed all issues for me. The rest of the problems were due to ctest (and our numa scheduler wrapped within it before the actual simulator) not correctly dying when jenkins asked them to do so.

  19. jenkins-infra-bot commented on Jan 15, 2019

    @jenkins-infra-bot
    Author
    dnusbaum:
    • Original comment link
    • Raw content of original comment:

      ncrmnt No problem! I will move forward with my PR (adding an additional timeout), thanks so much for interactively debugging the issue!

    ncrmnt No problem! I will move forward with my PR (adding an additional timeout), thanks so much for interactively debugging the issue!

  20. jenkins-infra-bot commented on Jan 31, 2019

    @jenkins-infra-bot
    Author
    dnusbaum:
    • Original comment link
    • Raw content of original comment:

      As of version 2.29 of the Pipeline Nodes and Process Plugin, the default timeout for remote calls is 20 seconds, and the value can be configured using the system property org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.REMOTE_TIMEOUT.

      I am marking this ticket as closed since that is the main cause of the issue identified from discussion in the comments (thanks ncrmnt!). If this issue is still occurring frequently for someone after increasing that value, please comment and we can investigate further.

    As of version 2.29 of the Pipeline Nodes and Process Plugin, the default timeout for remote calls is 20 seconds, and the value can be configured using the system property org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.REMOTE_TIMEOUT.

    I am marking this ticket as closed since that is the main cause of the issue identified from discussion in the comments (thanks ncrmnt!). If this issue is still occurring frequently for someone after increasing that value, please comment and we can investigate further.

  21. jenkins-infra-bot commented on Oct 18, 2019

    @jenkins-infra-bot
    Author
    tpoerio:
    • Original comment link
    • Raw content of original comment:

      Hi dnusbaum – when will this fix be released? My team needs it. (Or at least we think we do.)

       

      And I saw that this message is from about 9 months back, at time of writing.

       

      As of right now, the current release is only `2.200`, (released 10-14-2019).

       

      However, the post immediately above is referencing version `2.29`.

       

      Is it possible that this update is already present in `2.200`?

       

      If not, when will it become available in a stable release?  Many thanks for the help.

    Hi dnusbaum – when will this fix be released? My team needs it. (Or at least we think we do.)

     

    And I saw that this message is from about 9 months back, at time of writing.

     

    As of right now, the current release is only `2.200`, (released 10-14-2019).

     

    However, the post immediately above is referencing version `2.29`.

     

    Is it possible that this update is already present in `2.200`?

     

    If not, when will it become available in a stable release?  Many thanks for the help.

  22. jenkins-infra-bot commented on Dec 7, 2025

    @jenkins-infra-bot
    Author

    [Original is_duplicated_by from Jira: JENKINS-55416]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions