Details

    • Similar Issues:

      Description

      It seems that a deadlock has been introduced in some recent changes to workflow-cps-plugin.

      The whole jstack has been attached to the report, but two threads are waiting on each other:

      • the first thread is calling CpsFlowExecution#subsumeHead, got the lock on the instance, and then trying to acquire the r/w lock on the node storage
      • the second thread is calling CpsFlowExecution#getNode, got the r/w lock on the storage, and then is calling close which tries to get the instance lock

        Attachments

          Issue Links

            Activity

            Hide
            laurentgo Laurent Goujon added a comment -

            Hopefully the issue can be fixed by changing the order of operations. Here's my attempt at it: https://github.com/jenkinsci/workflow-cps-plugin/pull/225

            Show
            laurentgo Laurent Goujon added a comment - Hopefully the issue can be fixed by changing the order of operations. Here's my attempt at it: https://github.com/jenkinsci/workflow-cps-plugin/pull/225
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Laurent Goujon
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/4bc22731f72f24c0c007f34edb0c7018db37e0b3
            Log:
            JENKINS-51123: Fix deadlock in CpsFlowExecution

            A deadlock can arise if multiple threads tries to access storage
            simultaneously while one of them doing it from a synchronized
            method. The cause is that timing operation also tries to get the
            instance lock from inside the storage r/w lock.

            Solution is to change the order of locking by having the timing
            object wrapping the call to the r/w storage lock instead of the
            opposite.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Laurent Goujon Path: src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java http://jenkins-ci.org/commit/workflow-cps-plugin/4bc22731f72f24c0c007f34edb0c7018db37e0b3 Log: JENKINS-51123 : Fix deadlock in CpsFlowExecution A deadlock can arise if multiple threads tries to access storage simultaneously while one of them doing it from a synchronized method. The cause is that timing operation also tries to get the instance lock from inside the storage r/w lock. Solution is to change the order of locking by having the timing object wrapping the call to the r/w storage lock instead of the opposite.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sam Van Oort
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/34d0b82a87be5bf71ea0e5a6b14b0abe9efec5a9
            Log:
            Merge pull request #225 from laurentgo/laurentgo/JENKINS-51123

            JENKINS-51123: Fix deadlock in CpsFlowExecution

            Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/2358bcde8d30...34d0b82a87be
            *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

            Functionality will be removed from GitHub.com on January 31st, 2019.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java http://jenkins-ci.org/commit/workflow-cps-plugin/34d0b82a87be5bf71ea0e5a6b14b0abe9efec5a9 Log: Merge pull request #225 from laurentgo/laurentgo/ JENKINS-51123 JENKINS-51123 : Fix deadlock in CpsFlowExecution Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/2358bcde8d30...34d0b82a87be * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
            Hide
            pedersen Björn Pedersen added a comment -

            Is this fixed by the fix for issue 51132 as well?

            Show
            pedersen Björn Pedersen added a comment - Is this fixed by the fix for issue 51132 as well?
            Hide
            svanoort Sam Van Oort added a comment -

            Closing, since the fix is tracked in the other issue (technically it should be the other way around, but, eh.)

            Show
            svanoort Sam Van Oort added a comment - Closing, since the fix is tracked in the other issue (technically it should be the other way around, but, eh.)

              People

              • Assignee:
                Unassigned
                Reporter:
                laurentgo Laurent Goujon
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: