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

Do not rely on FilePathPickle #670

Merged
merged 1 commit into from
Jul 25, 2023
Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Jul 25, 2023

As of jenkinsci/workflow-durable-task-step-plugin#180, FilePath is not supposed to be directly serialized in program state, because it is tricky to resume a Java object referring to a live agent channel. WithMavenStepExecutionCallBack unfortunately did so, unlike say https://github.com/jenkinsci/credentials-binding-plugin/blob/8c080630bc65ef1eb1183d0e5cc179dc486122c0/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/UnbindableDir.java#L72 which would be used in

node(…) {
  withCredentials([file(…)]) {
    sh ''
  }
}

This could mean that if an agent failed to reattach to the controller after a restart, a build could hang indefinitely with a message like

Still trying to load Looking for path named ‘/home/jenkins/agent/workspace/…@tmp/withMaven276c1fbe’ on computer named ‘…’

(And if you were using the new retry-with-conditions idiom, it could be aborted but not successfully resumed on a fresh agent.)

You can see in the virtual thread dump why the program does not load:

Program is not yet loaded
	SettableFuture@29c83fa0[status=SUCCESS, result=[org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.None@61b7b33e]] (complete)
	SettableFuture@5282f2e8[status=SUCCESS, result=[org.csanchez.jenkins.plugins.kubernetes.PodTemplate@3b66bb3b]] (complete)
	SettableFuture@533ba6c8[status=SUCCESS, result=[org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.None@fc9d1d2]] (complete)
	SettableFuture@4a997771[status=SUCCESS, result=[org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStep@44a8a27a]] (complete)
	SettableFuture@4aab51c1[status=SUCCESS, result=[org.csanchez.jenkins.plugins.kubernetes.pipeline.KubernetesAgentErrorCondition@bad4e07]] (complete)
	SettableFuture@a0e82fc[status=SUCCESS, result=[org.jenkinsci.plugins.workflow.steps.SynchronousResumeNotSupportedErrorCondition@b344ab5]] (complete)
	SettableFuture@1b81274b[status=SUCCESS, result=[org.jenkinsci.plugins.workflow.support.steps.ExecutorStep@7abd8f4a]] (complete)
	SettableFuture@4daeb83[status=SUCCESS, result=[org.jenkinsci.plugins.pipeline.maven.publishers.GeneratedArtifactsPublisher@2d92784f]] (complete)
	Looking for path named ‘/home/jenkins/agent/workspace/…@tmp/withMaven276c1fbe’ on computer named ‘…’
	SettableFuture@3f3ba9c9[status=SUCCESS, result=[hudson.util.Secret@29eaa6bb]] (complete)

Filed jenkinsci/workflow-cps-plugin#755 in the course of identifying the withMaven step as the culprit.

@jglick jglick requested a review from a team as a code owner July 25, 2023 15:45
@bguerin bguerin self-assigned this Jul 25, 2023
@bguerin bguerin added the bug label Jul 25, 2023
@bguerin bguerin merged commit 09626b1 into jenkinsci:master Jul 25, 2023
@jglick jglick deleted the FilePathPickle branch July 25, 2023 21:36
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.

4 participants