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

Concurrent Groovy Shared Library syncs on different jobs use same workspace root

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Environment:
    • Similar Issues:

      Description

      We're encountering an issue where multiple jobs syncing a groovy shared library concurrently results in the wrong sync root being used for some of the jobs. For example, job1 and job2 are triggered at the same time and use the p4 plugin for syncing the groovy shared library. job1 will have the correct workspace root (e.g.  /var/lib/jenkins/jobs/job1/workspace%40libs/LIBRARYNAME) for the groovy shared library sync, but job2 will sync the groovy shared library to the same workspace root as job1 (e.g.  /var/lib/jenkins/jobs/job1/workspace%40libs/LIBRARYNAME). When job2 loads the groovy shared library, it references what the workspace root should be for job2 (e.g.  /var/lib/jenkins/jobs/job2/workspace%40libs/LIBRARYNAME), which was not sync'd to, and causes job2 to run based off of an old groovy shared library sync.

        Attachments

        1. error_logs.txt
          2 kB
        2. job1.txt
          4 kB
        3. job2.txt
          4 kB

          Activity

          Hide
          p4paul Paul Allen added a comment -

          Turns out EXECUTOR_NUMBER and WORKSPACE are not define when the client workspace is created, Jenkins sets these variables later.

          Plan B is to use a UUID and clean up (delete the client) after syncing the Library.

          Show
          p4paul Paul Allen added a comment - Turns out EXECUTOR_NUMBER and WORKSPACE are not define when the client workspace is created, Jenkins sets these variables later. Plan B is to use a UUID and clean up (delete the client) after syncing the Library.
          Hide
          premsai Prem Gangana added a comment - - edited

          > Having - is for uniformity sake since you were having jenkins-lib${NODE_NAME}-${JOB_ NAME}. 

          -> Deleting the client is actually what i was going to ask you about. Cleaning up the client is needed here, otherwise the clients are going to get stacked up.

          -> How about using BUILD_NUMBER ?

           

          Show
          premsai Prem Gangana added a comment - - edited > Having - is for uniformity sake since you were having jenkins-lib${NODE_NAME}-${JOB_ NAME}.  -> Deleting the client is actually what i was going to ask you about. Cleaning up the client is needed here, otherwise the clients are going to get stacked up. -> How about using BUILD_NUMBER ?  
          Hide
          p4paul Paul Allen added a comment -

          I have tried 'Plan B' a UUID and delete. 

          I have also exposed the delete option for Manual Workspaces (visible in FreeStyle and Pipeline 'checkout' steps).  Not too sure if I will release it like this as deleting the client for normal 'checkout' steps may effect polling.

          https://ci.jenkins.io/job/Plugins/job/p4-plugin/job/master/284/

          Show
          p4paul Paul Allen added a comment - I have tried 'Plan B' a UUID and delete.  I have also exposed the delete option for Manual Workspaces (visible in FreeStyle and Pipeline 'checkout' steps).  Not too sure if I will release it like this as deleting the client for normal 'checkout' steps may effect polling. https://ci.jenkins.io/job/Plugins/job/p4-plugin/job/master/284/
          Hide
          p4paul Paul Allen added a comment -

          Ready for release.

          Show
          p4paul Paul Allen added a comment - Ready for release.
          Hide
          p4paul Paul Allen added a comment -

          Released in 1.9.3

          Show
          p4paul Paul Allen added a comment - Released in 1.9.3

            People

            • Assignee:
              p4paul Paul Allen
              Reporter:
              kroutley Kurt Routley
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: