-
-
Notifications
You must be signed in to change notification settings - Fork 105
ContinuedTask cannot rely on queue scheduling order
#472
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
Conversation
| var tardyB = j.jenkins.getItemByFullName("tardy", WorkflowJob.class).getBuildByNumber(1); | ||
| j.waitForMessage("Ready to run", tardyB); | ||
| SemaphoreStep.success("tardy/1", null); | ||
| j.assertBuildStatusSuccess(j.waitForCompletion(tardyB)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java.lang.AssertionError:
unexpected build status; build log was:
------
Started
[Pipeline] Start of Pipeline
[Pipeline] slowToResume
[Pipeline] {
[Pipeline] node
Running on remote in …/agent-work-dirs/remote/workspace/tardy
[Pipeline] {
[Pipeline] semaphore
Resuming build at Mon Aug 18 19:22:29 EDT 2025 after Jenkins restart
Will resume outer step…
…resumed.
Waiting for reconnection of remote before proceeding with build
remote has been removed for 15 sec; assuming it is not coming back, and terminating node step
Ready to run at Mon Aug 18 19:22:47 EDT 2025
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // slowToResume
[Pipeline] End of Pipeline
Timeout waiting for agent to come back
org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 03aac892-2c78-4c34-b72f-f4fc12d3c117
Finished: ABORTED
------
Expected: is <SUCCESS>
but: was <ABORTED>
| @Override public void onResume() { | ||
| try { | ||
| getContext().get(TaskListener.class).getLogger().println("Will resume outer step…"); | ||
| Thread.sleep(3_000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passes without this delay.
Maybe a |
I do not want to introduce any global state. Only things that can be stored in build and/or agent root dirs. |
ContinuedTaskContinuedTask cannot rely on queue scheduling order
|
Related: #382 |
|
This approach seems to work, though I do not love the idea of writing |
There seems to be a race condition with
ContinuedTask: its effectiveness relies on thePlaceholderTaskthat was continued having actually been scheduled (and not merely inpendingsbut inbuildables) by the time other tasks are added to the queue. That is not a safe assumption at least since jenkinsci/workflow-api-plugin#221 (and possibly even before that), and certainly as of jenkinsci/workflow-api-plugin#368 this is not a good basis for blocking queue items. I think it is necessary to somehow mark theSlaveprior to shutdown as having been used for a given build, and wait for it to be ready before considering scheduling anything else onto the agent.(But not using anything inconfig.xml, since that would be clobbered by JCasC in the case of permanent agents.) Perhaps there is some simpler criterion that can be used.CloudBees-internal reference