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

Prevent some race condition in workflow-api

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • workflow-api-plugin
    • None
    • workflow-api-plugin-2.46

      Some race condition could happen in StandardGraphLookUpView when accessing the 

      blockStartToEnd
      

      and  

      nearestEnclosingBlock

      maps, leading to a high CPU usage and blocking threads.

      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND  
      32499 abcde     20   0 23.8g  18g  12m S **790.4** 30.0   7308:41 /xenv/java/X/1.8.0_261l64/bin/java -Xms16384m -Xmx16384m -verbose:gc -Xloggc:/BuildDir/XXX/logs/gc-%t.log -XX:NumberOfGCLogFiles=2 -XX:+UseGCLogFileRotation -XX:GCLogFileSize=100m -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCD
      

      High CPU consuming threads:

      "Running ..." #1403846 daemon prio=5 os_prio=0 tid=0x00007f00581ef800 nid=0x1133 runnable [0x00007f00050ef000]
      java.lang.Thread.State: RUNNABLE
      at org.jenkinsci.plugins.workflow.graph.StandardGraphLookupView.bruteForceScanForEnclosingBlock(StandardGraphLookupView.java:133)
      at org.jenkinsci.plugins.workflow.graph.StandardGraphLookupView.findEnclosingBlockStart(StandardGraphLookupView.java:194)
      at org.jenkinsci.plugins.workflow.graph.GraphLookupView$EnclosingBlocksIterable$EnclosingBlocksIterator.<init>(GraphLookupView.java:66)
      at org.jenkinsci.plugins.workflow.graph.GraphLookupView$EnclosingBlocksIterable.iterator(GraphLookupView.java:100)
      at org.jenkinsci.plugins.workflow.job.console.NewNodeConsoleNote.<init>(NewNodeConsoleNote.java:94)
      at org.jenkinsci.plugins.workflow.job.console.NewNodeConsoleNote.print(NewNodeConsoleNote.java:76)
      - locked <0x00000005d9e3b650> (a java.io.PrintStream)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun$NodePrintListener.onNewHead(WorkflowRun.java:1051)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1473)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.notifyNewHead(CpsThreadGroup.java:472)
      at org.jenkinsci.plugins.workflow.cps.FlowHead.setNewHead(FlowHead.java:157)
      at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:254)
      

      and

      "Handling GET ...." #11819 prio=5 os_prio=0 tid=0x00007f01181f0800 nid=0x6d0a runnable [0x00007f0008d25000]
         java.lang.Thread.State: RUNNABLE
          at java.util.HashMap.hash(HashMap.java:339)
          at java.util.HashMap.get(HashMap.java:557)
          at org.jenkinsci.plugins.workflow.graph.StandardGraphLookupView.bruteForceScanForEnclosingBlock(StandardGraphLookupView.java:133)
          at org.jenkinsci.plugins.workflow.graph.StandardGraphLookupView.findEnclosingBlockStart(StandardGraphLookupView.java:194)
          at org.jenkinsci.plugins.workflow.graph.GraphLookupView$EnclosingBlocksIterable$EnclosingBlocksIterator.<init>(GraphLookupView.java:66)
          at org.jenkinsci.plugins.workflow.graph.GraphLookupView$EnclosingBlocksIterable.iterator(GraphLookupView.java:100)
          at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.computeEnclosingLabel(ExecutorStepExecution.java:642)
          at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.getEnclosingLabel(ExecutorStepExecution.java:633)
          at sun.reflect.GeneratedMethodAccessor1421.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
      

            bitwiseman Liam Newman
            twasyl Thierry Wasylczenko
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: