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

[JENKINS-66258] Retrieve non transient actions to prevent deadlock #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dohbedoh
Copy link

@Dohbedoh Dohbedoh commented Nov 20, 2024

JENKINS-66258 do not lookup transient action factories for a AbstractTestResultAction to prevent deadlock through workflow-api.

NOTE: As discussed in the issue, a further improvement of this plugin would be to handle work asynchronously from LogstashOutputStream.eol. What we ought to do here is a fix to prevent deadlocks int he meantime.

Testing done

Run a simple pipeline with a junit step:

node {
    
    [...]
    
    sh "mvn clean install"
    
    junit(
        allowEmptyResults: true,
        testResults: '**/target/surefire-reports/**/*.xml,**/target/failsafe-reports/**/*.xml,**/target/invoker-reports/**/*.xml'
    )
}

Validate in debug that the TestResultAction is retrieved with the proper details.
Validate in debug that the LogstashOutputStream.eol does not go through TransientActionFactory#factoriesFor

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@Dohbedoh Dohbedoh requested a review from a team as a code owner November 20, 2024 01:53
@Dohbedoh
Copy link
Author

ping @jakub-bochenski

@jakub-bochenski
Copy link

hey, I'm out of my depth here :)
I've read the ticket but I haven't been following the related changes in Jenkins infrastructure.

Using a deprecated method that has "No clear purpose" seems bad, though I guess not as bad as causing a deadlock.

What would be the proper way to solve it?

@@ -276,7 +276,10 @@ public void updateResult()
Result result = build.getResult();
this.result = result == null ? null : result.toString();
}
Action testResultAction = build.getAction(AbstractTestResultAction.class);
@SuppressWarnings("deprecation") // We don't need transient actions
Action testResultAction = build.getActions().stream()

Choose a reason for hiding this comment

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

why not getActions(Class) ?

Choose a reason for hiding this comment

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

ok, I guess getActions(Class) does try to get transient actions and that is the problem
wouldn't it better if the build.getAction(Class) were smart enough to determine that I'm requesting a non-transient action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants