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

checkout step returns wrong P4_CLIENT when used in parallel step

    • Icon: Bug Bug
    • Resolution: Postponed
    • Icon: Major Major
    • p4-plugin
    • Jenkins LTS 2.73.3
      P4 Plugin 1.8.3

      Note that I can't repro this with a very small set of files to sync, so I'm using a path that has ~160MB at the moment. Found on a much larger job. Not sure where the dividing line is, but at this size it seems to be 100%.

      Test script:

      def syncWorkspace(branchName) {
          def workspaceSpec = templateSpec(charset: 'none', format: "Jenkins_Experiments_${branchName}_${env.NODE_NAME}",
                      pinHost: true, templateName: <template>)
      
          def p4Env = checkout scm: perforce(credential: <credentials>,
              populate: autoClean(delete: true, modtime: false, pin: '', quiet: true, replace: true, tidy: false), workspace: workspaceSpec)
      
          println "${p4Env}"
      }
      
      node() {
          parallel firstBranch: {
              def branchName = 'firstBranch'
              syncWorkspace(branchName)
          }, secondBranch: {
              def branchName = 'secondBranch'
              syncWorkspace(branchName)
          }
      }
      

      Output from the log statements:

      [secondBranch] [HUDSON_CHANGELOG_FILE:/var/lib/jenkins/jobs/Experiments/jobs/Test_P4Bug/builds/19/changelog0.xml, P4_CHANGELIST:13506, P4_CLIENT:Jenkins_Experiments_secondBranch_CGSERVER2, P4_PORT:192.168.0.51:1666, P4_TICKET:BB5D0811AB2A6ABE6D240C2E4A64A54B, P4_USER:headless]
      
      [firstBranch] [HUDSON_CHANGELOG_FILE:/var/lib/jenkins/jobs/Experiments/jobs/Test_P4Bug/builds/19/changelog0.xml, P4_CHANGELIST:13506, P4_CLIENT:Jenkins_Experiments_secondBranch_CGSERVER2, P4_PORT:192.168.0.51:1666, P4_TICKET:BB5D0811AB2A6ABE6D240C2E4A64A54B, P4_USER:headless]
      

      On occasion, firstBranch will return the P4_CLIENT of secondBranch, but every recent run of this script has returned secondBranch for both. I imagine other variables might also be wrong in the result if they weren't identical across both checkout steps, but I haven't checked.

          [JENKINS-48449] checkout step returns wrong P4_CLIENT when used in parallel step

          Karl Wirth added a comment -

          Known bug in Jenkins. For example if you print variable once, then that value changes (for example performing a second sync) then the variable remains stuck at the first value.

          If you do not read the variable before it changes (for example echo it) then the second value will be used.

          Will ensure the bug in Jenkins is raised.

          Karl Wirth added a comment - Known bug in Jenkins. For example if you print variable once, then that value changes (for example performing a second sync) then the variable remains stuck at the first value. If you do not read the variable before it changes (for example echo it) then the second value will be used. Will ensure the bug in Jenkins is raised.

          Paul Allen added a comment -

          Unable to fix issue - Need Jenkins to fix the environment.

          Paul Allen added a comment - Unable to fix issue - Need Jenkins to fix the environment.

          Phil McArdle added a comment -

          Do you know the bug number of the underlying issue in Jenkins?

          Phil McArdle added a comment - Do you know the bug number of the underlying issue in Jenkins?

            p4karl Karl Wirth
            philmcardlecg Phil McArdle
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: