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

P4_CLIENT environment variable wrong for parallel builds

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: p4-plugin
    • Labels:
      None
    • Environment:
      Jenkins v2.235.1
      P4 Plugin 1.10.13
      Master and Server on Debian
      Agent on Windows 10
      JAva 8
    • Similar Issues:

      Description

      I recently upgraded from version 1.9.5, where I didn't see this issue.  I have several FreeStyleBuilds that run on Swarm reviews.  They execute concurrent builds, one per agent.  They use the P4_CLIENT environment variable to find what files are unshelved in the default changelist, but when two builds start at similar times one of them will have the P4_CLIENT variable from the other.

      My client names do not use the executor number because there is only ever one executor, so this is not a duplicate of JENKINS-60213.

      I have managed to reproduce the error with the attached build configuration (server credential name removed).  It has a timer trigger for 1/minute but I had to spam the Build button with two agents connected to the master to get the job to fail.

        Attachments

        1. config.xml
          3 kB
        2. console3_SUCCESS.txt
          3 kB
        3. console4_FAILURE.txt
          3 kB
        4. console5_SUCCESS.txt
          3 kB

          Activity

          Hide
          p4karl Karl Wirth added a comment -

          Hi Nick Ridgway,

          Thanks for the details. Can you get me the console log from the failed job and the working one either side (for example job 45 46 and 47).

          As a first step I tried this one Linux and couldn't repro so will source a couple of extra Windows machines and will try on those.

          My Linux code was:

           

          sleep 60  # Tried with and without the sleep.
          echo jenkins-NODE_NAME-JOB_NAME: jenkins-$NODE_NAME-$JOB_NAME
          echo P4CLIENT: $P4CLIENTif [ "jenkins-$NODE_NAME-$JOB_NAME" = "$P4CLIENT" ]; then
              echo "Strings are equal."
              exit 0
          else
              echo "Strings are not equal."
              exit 1
          fi
          

           

          Show
          p4karl Karl Wirth added a comment - Hi Nick Ridgway , Thanks for the details. Can you get me the console log from the failed job and the working one either side (for example job 45 46 and 47). As a first step I tried this one Linux and couldn't repro so will source a couple of extra Windows machines and will try on those. My Linux code was:   sleep 60 # Tried with and without the sleep. echo jenkins-NODE_NAME-JOB_NAME: jenkins-$NODE_NAME-$JOB_NAME echo P4CLIENT: $P4CLIENTif [ "jenkins-$NODE_NAME-$JOB_NAME" = "$P4CLIENT" ]; then echo "Strings are equal." exit 0 else echo "Strings are not equal." exit 1 fi  
          Hide
          rebnridgway Nick Ridgway added a comment -

          I have attached console logs (minus some server details) showing the failure.

          What's the difference between P4CLIENT and P4_CLIENT?  I am using the latter in my job but you used the former in your test.

          Show
          rebnridgway Nick Ridgway added a comment - I have attached console logs (minus some server details) showing the failure. What's the difference between P4CLIENT and P4_CLIENT?  I am using the latter in my job but you used the former in your test.
          Hide
          p4karl Karl Wirth added a comment -

          Hi Nick Ridgway - Good spot thanks.

          Its an environment variable I set that should be the same as P4_CLIENT but its better that I test the real variable!

          First couple of Linux passes since fixing the script still not showing it but I'll keep testing then move onto Windows.

          Show
          p4karl Karl Wirth added a comment - Hi Nick Ridgway - Good spot thanks. Its an environment variable I set that should be the same as P4_CLIENT but its better that I test the real variable! First couple of Linux passes since fixing the script still not showing it but I'll keep testing then move onto Windows.

            People

            • Assignee:
              Unassigned
              Reporter:
              rebnridgway Nick Ridgway
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: