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

Parallel builds with same parameters cause parallel block to hang forever

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • build-flow-plugin
    • Jenkins version 2.19.4
      Build Flow plugin version 0.20

      Triggering the same job twice with the same parameters concurrently using a parallel block causes the two jobs to get the same job number and causes the parallel block to hang.

      In the flow script below, ParallelChild1 is just a regular freestyle job with concurrent execution enabled, and one string parameter which is empty by default.

      parallel (
        { build("ParallelChild1") },
        { build("ParallelChild1") }
      )
      

      The Jenkins console output when running this flow script is:

      Started by user PF
      parallel {
          Schedule job ParallelChild1
          Schedule job ParallelChild1
          Build ParallelChild1 #70 started
          Build ParallelChild1 #70 started
          ParallelChild1 #70 completed
       
      

      The script then hangs forever. From the Monitoring plugin I can see that there is a thread called "BuildFlow parallel statement thread for Parallel_Debug" which never ends.
      The stack trace for that thread is:

      BuildFlow parallel statement thread for Parallel_Debug
      sun.misc.Unsafe.park(Native Method)
      java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
      java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
      java_util_concurrent_locks_Condition$await$0.call(Unknown Source)
      org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
      com.cloudbees.plugins.flow.JobInvocation.waitForFinalization(JobInvocation.groovy:259)
      com.cloudbees.plugins.flow.FlowRun.waitForFinalization(FlowRun.java:111)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:233)
      org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
      org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      com.cloudbees.plugins.flow.FlowDelegate.build(FlowDSL.groovy:227)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
      com.cloudbees.plugins.flow.FlowDelegate.invokeMethod(FlowDSL.groovy)
      hudson.util.spring.ClosureScript.invokeMethod(ClosureScript.java:83)
      org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:430)
      org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:369)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
      org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
      Script1$_run_closure1.doCall(Script1.groovy:41)
      Script1$_run_closure1.doCall(Script1.groovy)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
      com.cloudbees.plugins.flow.FlowDelegate$_parallel_closure5_closure7.doCall(FlowDSL.groovy:443)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
      org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
      org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
      com.cloudbees.plugins.flow.FlowDelegate$_parallel_closure5_closure7.doCall(FlowDSL.groovy)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
      groovy.lang.Closure.call(Closure.java:414)
      groovy.lang.Closure.call(Closure.java:408)
      java.util.concurrent.FutureTask.run(FutureTask.java:266)
      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      java.lang.Thread.run(Thread.java:745)

            Unassigned Unassigned
            fradgers Paul Fradgley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: