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

Apparent race condition in parallel steps (scripted pipeline) causes steps to be hidden from pipeline view

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • groovy-plugin

      I'm experiencing an issue with the parallel step in scripted pipeline. I'm having trouble coming up with a reproducible example that doesn't involve pasting my entire script library, but hopefully I can still provide some hints as to where the error might be coming from.

      An oversimplified example (that unfortunately does not cause the problem) looks like this:

      parallel "a": {
        node {
          echo "A started"
          sh "sleep 30"
          echo "A finished"
        }
      },
      
      "b": {
        node {
          echo "B started"
          sh "sleep 60"
          echo "B finished" // this step is NOT displayed in the UI.  ?!?!
        }
      },
      
      "c": {
        node {
          echo "C started"
          sh "sleep 30"
          echo "C finished"
        }
      }
      

      In my case, the equivalent of the step "B finished" is never shown on the pipeline view. But It IS shown in the new window if you click "Display the log in new window"

      At first I thought this was some problem with what's happening in stage b. But on further experimentation it seems to be a race condition of some kind. I can avoid the problem completely by adding arbitrary sleep steps to the other parallel stages:

      parallel "a": {
        node {
          echo "A started"
          sh "sleep 30"
          echo "A finished"
          sh "sleep 30" // this works around the bug in stage b"
        }
      },
      
      "b": {
        node {
          echo "B started"
          sh "sleep 60"
          echo "B finished" // this step WILL be displayed in the UI
        }
      },
      
      "c": {
        node {
          echo "C started"
          sh "sleep 30"
          echo "C finished"
          sh "sleep 30" // this works around the bug in stage b"
        }
      }
      

      In other words, it seems like the UI stops rendering the output of the "b" stage when either "a" or "c" has completed, even though the full execution of "b" is visible in the logs when viewed individually.

            vjuranek vjuranek
            ianfixes Ian Katz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: