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

Add a timeout for pickle resolution to prevent indefinitely stuck builds #278

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

dwnusbaum
Copy link
Member

Related to jenkinsci/workflow-api-plugin#357 and jenkinsci/workflow-api-plugin#347. Even though the fix there should prevent stuck builds from leaking memory of other builds, it is still worth trying to prevent builds from getting stuck in the first place.

This PR adds a hard timeout to pickle resolution. I do not care much about the exact timeout, I just want to pick a value that doesn't break pickle resolution in non-pathological cases. The case described in jenkinsci/workflow-api-plugin#357 involved a build repeatedly resuming and trying to resolve a FilePathPickle that was never going to come back for around a month.

If preferred this could be done in CpsFlowExecution.loadProgramAsync or TryRepeatedly instead.

Testing done

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

@dwnusbaum dwnusbaum added the bug label Sep 17, 2024
@dwnusbaum dwnusbaum requested a review from a team as a code owner September 17, 2024 20:47
*/
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Non-final for modification from script console")
public static long RESOLUTION_TIMEOUT_SECONDS = SystemProperties.getLong(PickleResolver.class + ".RESOLUTION_TIMEOUT_SECONDS", TimeUnit.HOURS.toSeconds(1));
Copy link
Member Author

@dwnusbaum dwnusbaum Sep 17, 2024

Choose a reason for hiding this comment

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

Not sure what value is best here. One hour resolving pickles seemed roughly ok to me. I think we don't really expect TryRepeatedly to be used normally anyway now that ExecutorStepDynamicContext and FilePathDynamicContext exist, but there are a couple of other usages.

@jglick jglick merged commit 07b215a into jenkinsci:master Sep 17, 2024
16 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