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

Stale closure warnings when using StepListener to fail build

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • workflow-cps: 3996.va_f5c1799f978 (also verified in 4002.v80ca_d0f47d7f)

      I don't believe any other versions or environmental factors are relevant

      I'm opening this as "bug" because it's not working as intended (I assume) and the behavior results in unavoidable warning logs; there is nothing actually broken.

       

      I'm implementing StepListener (from workflow-api), which has documented use-case

      such as calling StepContext#onFailure to make the step fail before it starts.

      Doing so for a step with a body (such as node) results in stale closures, which are logged at warning level.

      From what I gather, there are two places where unexport happens, one which seems to be a special case for load/parallel. The one that normally gets hit only does so when the step is in async mode. But because onFailure was called prior to the step even starting, it never got a chance to switch modes.

      If my understanding of the problem is correct, this 'bug' has probably been here for many years. The page that lists known extension point implementations shows only four entries and none are using it to set success/failure like I am. My primary concern is the logger warnings; I don't want my plugin spamming my logs, but I also don't want to silence that logger and lose legitimate warnings in the process.

      If you need an actual minimal reproducer I can put one together, but hoped the description was enough.  An extension that does nothing but sets failure against node is sufficient to show it.

          [JENKINS-75067] Stale closure warnings when using StepListener to fail build

          I provided a test case and potential fix in https://github.com/jenkinsci/workflow-cps-plugin/pull/966.

          Roberto Villarreal added a comment - I provided a test case and potential fix in https://github.com/jenkinsci/workflow-cps-plugin/pull/966 .

            rrjjvv Roberto Villarreal
            rrjjvv Roberto Villarreal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: