Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid "IOException: cannot find current thread" when submitting an input step that ends a CpsThread #158

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

dwnusbaum
Copy link
Member

Fixes a timing issue in #145 - whenever the input step was the last part of a CpsThread, it was possible that the thread would be removed from the thread group before we called StepContext.get, causing CpsThreadGroup.doGet to throw an exception.

jenkinsci/workflow-support-plugin#252 would make this kind of change obsolete, but this change is minimal and cannot affect other plugins, so I think worth considering as a hotfix.

Testing done

I tested this manually using a test that failed reliably after jenkinsci/workflow-support-plugin#252. With this change, it passes reliably.

Submitter checklist

@dwnusbaum dwnusbaum requested a review from a team as a code owner February 7, 2024 17:47
@dwnusbaum dwnusbaum added the bug label Feb 7, 2024
@dwnusbaum dwnusbaum changed the title Obtain the run before the step completes to avoid issues when the CpsThread completes immediately Avoid "IOException: cannot find current thread" when submitting an input step that ends a CpsThread Feb 7, 2024
@dwnusbaum dwnusbaum requested a review from jglick February 7, 2024 17:50
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe.

@dwnusbaum dwnusbaum merged commit b07d21d into jenkinsci:master Feb 7, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants