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

lock step interacts badly with timeout step

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a job which takes a lock {} inside of a timeout {} block.

      If the timeout expires, then the lock {} is not freed, which results in future taking of the lock becoming a deadlock.

      It seems like timeout {} should properly free the lock when forcing an exit from the lock() step? Is this just a bad pipeline/workflow pattern?

        Attachments

          Activity

          Hide
          jekeller Jacob Keller added a comment -

           

          This is with Lockable Resource Plugin 2.0

          I'm not 100% sure if the issue is a timeout() killing the lock() or not. I looked at the pipeline graph, and I see a timeout set to 15 minutes and the lock is blocked for 13 minutes, so it's possible this isn't the issue. I also had 2 other branches of parallel pipeline that ended up blocking for 4 days before we killed the job.

          Specifically, the lock is only used inside a single build to limit parallelism of a section that cannot be run concurrently during a parallel{} chunk. Since the lockable resource name includes the BUILD_TAG, it should be a resource unique to the individual build, and thus the only places it should become locked are in other parallel threads.

          Any other ideas what might cause the deadlock?

          Show
          jekeller Jacob Keller added a comment -   This is with Lockable Resource Plugin 2.0 I'm not 100% sure if the issue is a timeout() killing the lock() or not. I looked at the pipeline graph, and I see a timeout set to 15 minutes and the lock is blocked for 13 minutes, so it's possible this isn't the issue. I also had 2 other branches of parallel pipeline that ended up blocking for 4 days before we killed the job. Specifically, the lock is only used inside a single build to limit parallelism of a section that cannot be run concurrently during a parallel{} chunk. Since the lockable resource name includes the BUILD_TAG, it should be a resource unique to the individual build, and thus the only places it should become locked are in other parallel threads. Any other ideas what might cause the deadlock?
          Hide
          getrostt Tobias Getrost added a comment -

          It looks as if the timeout is the reason why the lock is not released. I created a test to reproduce the behaviour: https://github.com/getrostt/lockable-resources-plugin/tree/jenkins-50260

          Show
          getrostt Tobias Getrost added a comment - It looks as if the timeout is the reason why the lock is not released. I created a test to reproduce the behaviour:  https://github.com/getrostt/lockable-resources-plugin/tree/jenkins-50260

            People

            • Assignee:
              Unassigned
              Reporter:
              jekeller Jacob Keller
            • Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: