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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Jenkins ver. 2.164.2
      Lockable Resources plugin version: 2.5

      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! 

       

       

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

              Created:
              Updated: