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

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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! 

       

       

            Assignee:
            Unassigned
            Reporter:
            Beer Michael
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: