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

Lockable resource didn't work, if two jobs acquires lock at same time

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.164.2
      Lockable Resources plugin version: 2.5
    • Similar Issues:

      Description

      Lockable resource is used in the options block of the pipeline like this: 

      options {
             timestamps()
             skipDefaultCheckout()
             lock resource: "Lock_Slave_${SlaveName.split(',').first()}"
             timeout(time: "$JobTimeout" as Integer, unit: "HOURS")
      }

      There are three jobs in the Jenkins System, which are using the same SlaveName (build with parameters parameter). All 3 jobs are started at the same time. After the first job is started, the other 2 jobs waits for the lock. After the job is done, the two other jobs acquires the lock at the same time. 

       

      Console log job 1:

      2019-05-02 10:23:55  Trying to acquire lock on [Lock_Slave_TIS_MainTargets]

      2019-05-02 10:23:55  Found 0 available resource(s). Waiting for correct amount: 1.

      2019-05-02 10:23:55  [Lock_Slave_TIS_MainTargets] is locked, waiting...

      2019-05-02 11:05:58  Lock acquired on [Lock_Slave_TIS_MainTargets]

       

      Console log job 2:

      2019-05-02 10:24:52  Trying to acquire lock on [Lock_Slave_TIS_MainTargets]

      2019-05-02 10:24:52  Found 0 available resource(s). Waiting for correct amount: 1.

      2019-05-02 10:24:52  [Lock_Slave_TIS_MainTargets] is locked, waiting...

      2019-05-02 11:05:58  Lock acquired on [Lock_Slave_TIS_MainTargets]

       

      As you can see, the two jobs acquires the lock "Lock_Slave_TIS_MainTargets" at the same time. 

       

      Get in contact with me if you need more information. Thanks in advance! 

       

       

        Attachments

          Activity

          Hide
          ethorsa ethorsa added a comment -

          Can you check the log of the first build for a double release of the Lock? I recently had a build where the lock was released twice: At the end of the stage (as expected) and once more at the end of the pipeline.

          Show
          ethorsa ethorsa added a comment - Can you check the log of the first build for a double release of the Lock? I recently had a build where the lock was released twice: At the end of the stage (as expected) and once more at the end of the pipeline.

            People

            • Assignee:
              Unassigned
              Reporter:
              mibe Beer Michael
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: