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

Clear CpsBodyExecution.thread #925

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ public Next receive(Object o) {
sc.onFailure(t);
}
}
synchronized (CpsBodyExecution.this) {
thread = null;
}
return Next.terminate(null);
}

Expand All @@ -377,6 +380,9 @@ public Next receive(Object o) {
sc.onFailure(e);
}
}
synchronized (CpsBodyExecution.this) {
thread = null;
}
return Next.terminate(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
} else {
handler.context.onSuccess(success);
}
// TODO should this also bodies.clear()?

Check warning on line 179 in plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: should this also bodies.clear()?
Copy link
Member Author

Choose a reason for hiding this comment

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

The originally observed error, which I was unable to reproduce exactly in a functional test, involved the CpsBodyExecution being held from ParallelStepExecution.bodies:

an exception which occurred:
	in object of type org.jenkinsci.plugins.workflow.cps.FlowHead
	in field org.jenkinsci.plugins.workflow.cps.CpsThread.head
	in object org.jenkinsci.plugins.workflow.cps.CpsThread@282f4605
	in object of type org.jenkinsci.plugins.workflow.cps.CpsThread
	in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.thread
	in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution@6c50e364
	in object of type org.jenkinsci.plugins.workflow.cps.CpsBodyExecution
	in element at index [1] of size [3]
	in field org.jenkinsci.plugins.workflow.cps.steps.ParallelStepExecution.bodies
	in object org.jenkinsci.plugins.workflow.cps.steps.ParallelStepExecution@4416bb37
	in object of type org.jenkinsci.plugins.workflow.cps.steps.ParallelStepExecution
	in field org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler.stepExecution
	in object org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler@253b016b
	in object of type org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler
	in field org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback.handler
	in object org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback@1193a1ed
	in object of type org.jenkinsci.plugins.workflow.cps.steps.ParallelStep$ResultHandler$Callback
	in element at index [0] of size [1]
	in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.callbacks
	in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution@4a46a38c
	in object of type org.jenkinsci.plugins.workflow.cps.CpsBodyExecution
	in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.this$0
	in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter@3bf876f0
	in object of type org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter
	in field com.cloudbees.groovy.cps.impl.CallEnv.returnAddress
	in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@463508bd
	in object of type com.cloudbees.groovy.cps.impl.FunctionCallEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.TryBlockEnv@4aa5555f
	in object of type com.cloudbees.groovy.cps.impl.TryBlockEnv
	in field com.cloudbees.groovy.cps.impl.CallEnv.caller
	in object com.cloudbees.groovy.cps.impl.ClosureCallEnv@3500c544
	in object of type com.cloudbees.groovy.cps.impl.ClosureCallEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4d376ae2
	in object of type com.cloudbees.groovy.cps.impl.BlockScopeEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@23a9e319
	in object of type com.cloudbees.groovy.cps.impl.BlockScopeEnv
	in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
	in object com.cloudbees.groovy.cps.impl.CpsClosureDef@43c6459e
	in object of type com.cloudbees.groovy.cps.impl.CpsClosureDef
	in field com.cloudbees.groovy.cps.impl.CpsClosure.def
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@705f8247
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in object of type java.util.LinkedHashMap
	in object of type WorkflowScript
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@64986d4
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@6a940c2f
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@1b0f4e56
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@174eaaca
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@5dfbe1d1
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@17446b35
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@76d8ea75
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@1422169e
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@165588a2
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@227c449e
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@13c699e6
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@1754fbe6
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@2d7e6136
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@6d6698b3
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@4ac82550
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in object of type java.util.HashMap
	in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@7a736c24
	in object of type org.jenkinsci.plugins.workflow.cps.CpsThreadGroup
Caused: java.lang.IllegalStateException: FlowHead loading problem at deserialize: Null FlowHead with id … in execution …
	at org.jenkinsci.plugins.workflow.cps.FlowHead.readResolve(FlowHead.java:207)
	at …

In this case the ParallelStepExecution was complete, so there was no reason for it to still be holding onto its bodies. (There was no good reason for program.dat to be holding onto the ParallelStepExecution itself; this was due to a forgotten def.)

}

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import groovy.lang.Closure;
import hudson.model.Result;
import hudson.slaves.DumbSlave;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import org.codehaus.groovy.runtime.ScriptBytecodeAdapter;
import org.jenkinsci.plugins.workflow.actions.ErrorAction;
import org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode;
Expand All @@ -31,22 +34,23 @@
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.RestartableJenkinsRule;
import org.jvnet.hudson.test.TestExtension;
import org.kohsuke.stapler.DataBoundConstructor;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.hamcrest.Matchers.not;
import org.jenkinsci.plugins.workflow.graphanalysis.DepthFirstScanner;
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.jvnet.hudson.test.JenkinsSessionRule;

public class CpsBodyExecutionTest {

@ClassRule public static BuildWatcher buildWatcher = new BuildWatcher();
@Rule public RestartableJenkinsRule rr = new RestartableJenkinsRule();
@Rule public JenkinsSessionRule rr = new JenkinsSessionRule();

/**
* When the body of a step is synchronous and explodes, the failure should be recorded and the pipeline job
Expand All @@ -60,7 +64,7 @@ public class CpsBodyExecutionTest {
* never arrives.
*/
@Test
public void synchronousExceptionInBody() throws Exception {
public void synchronousExceptionInBody() throws Throwable {
rr.then(jenkins -> {
WorkflowJob p = jenkins.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition("synchronousExceptionInBody()",true));
Expand Down Expand Up @@ -138,7 +142,7 @@ public boolean start() throws Exception {
}

@Issue("JENKINS-34637")
@Test public void currentExecutions() throws Exception {
@Test public void currentExecutions() throws Throwable {
rr.then(jenkins -> {
WorkflowJob p = jenkins.createProject(WorkflowJob.class);
p.setDefinition(new CpsFlowDefinition("parallel main: {retainsBody {parallel a: {retainsBody {semaphore 'a'}}, b: {retainsBody {semaphore 'b'}}}}, aside: {semaphore 'c'}", true));
Expand Down Expand Up @@ -200,7 +204,7 @@ public static class Execution extends AbstractStepExecutionImpl {
}

@Issue({"JENKINS-53709", "JENKINS-41791"})
@Test public void popContextVarsOnBodyCompletion() {
@Test public void popContextVarsOnBodyCompletion() throws Throwable {
rr.then(r -> {
DumbSlave s = r.createOnlineSlave();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
Expand All @@ -226,7 +230,7 @@ public static class Execution extends AbstractStepExecutionImpl {
}

@Issue("JENKINS-63164")
@Test public void closureCapturesCpsBodyExecution() {
@Test public void closureCapturesCpsBodyExecution() throws Throwable {
rr.then(r -> {
DumbSlave s = r.createOnlineSlave();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "demo");
Expand All @@ -253,4 +257,28 @@ public static class Execution extends AbstractStepExecutionImpl {
});
}

@Test public void capturedBodies() throws Throwable {
var semaphores = List.of("y1", "y2");
AtomicReference<Path> buildXml = new AtomicReference<>();
rr.then(r -> {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("parallel x1: {}, x2: {g = {x -> x + 1}; echo(/${g(1)}/)}; parallel y1: {semaphore 'y1'}, y2: {semaphore 'y2'}", true));
Copy link
Member Author

Choose a reason for hiding this comment

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

(note lack of def on g)

WorkflowRun b = p.scheduleBuild2(0).waitForStart();
for (var semaphore : semaphores) {
SemaphoreStep.waitForStart(semaphore + "/1", b);
}
buildXml.set(b.getRootDir().toPath().resolve("build.xml"));
});
Files.copy(buildXml.get(), System.out);
rr.then(r -> {
WorkflowJob p = r.jenkins.getItemByFullName("p", WorkflowJob.class);
WorkflowRun b = p.getLastBuild();
for (var semaphore : semaphores) {
SemaphoreStep.success(semaphore + "/1", null);
}
r.assertBuildStatusSuccess(r.waitForCompletion(b));
Copy link
Member Author

Choose a reason for hiding this comment

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

Without fix:

Started
[Pipeline] Start of Pipeline
[Pipeline] parallel
[Pipeline] { (Branch: x1)
[Pipeline] { (Branch: x2)
[Pipeline] }
[Pipeline] echo
2
[Pipeline] }
[Pipeline] // parallel
[Pipeline] parallel
[Pipeline] { (Branch: y1)
[Pipeline] { (Branch: y2)
[Pipeline] semaphore
[Pipeline] semaphore
an exception which occurred:
	in object of type org.jenkinsci.plugins.workflow.cps.FlowHead
	in field org.jenkinsci.plugins.workflow.cps.CpsThread.head
	in object org.jenkinsci.plugins.workflow.cps.CpsThread@98ddd75
	in object of type org.jenkinsci.plugins.workflow.cps.CpsThread
	in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.thread
	in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution@380efbea
	in object of type org.jenkinsci.plugins.workflow.cps.CpsBodyExecution
	in field org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.this$0
	in object org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter@4bdab55d
	in object of type org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter
	in field com.cloudbees.groovy.cps.impl.CallEnv.returnAddress
	in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@2cdbbf26
	in object of type com.cloudbees.groovy.cps.impl.FunctionCallEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.TryBlockEnv@62056750
	in object of type com.cloudbees.groovy.cps.impl.TryBlockEnv
	in field com.cloudbees.groovy.cps.impl.CallEnv.caller
	in object com.cloudbees.groovy.cps.impl.ClosureCallEnv@2d9b1151
	in object of type com.cloudbees.groovy.cps.impl.ClosureCallEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@33f539e2
	in object of type com.cloudbees.groovy.cps.impl.BlockScopeEnv
	in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
	in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@42a69235
	in object of type com.cloudbees.groovy.cps.impl.BlockScopeEnv
	in field com.cloudbees.groovy.cps.impl.CpsClosureDef.capture
	in object com.cloudbees.groovy.cps.impl.CpsClosureDef@bd042d6
	in object of type com.cloudbees.groovy.cps.impl.CpsClosureDef
	in field com.cloudbees.groovy.cps.impl.CpsClosure.def
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@7e34cb64
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in object of type java.util.LinkedHashMap
	in object of type WorkflowScript
	in field groovy.lang.Closure.delegate
	in object org.jenkinsci.plugins.workflow.cps.CpsClosure2@6494c769
	in object of type org.jenkinsci.plugins.workflow.cps.CpsClosure2
	in object of type java.util.HashMap
	in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
	in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@12d5c6f4
	in object of type org.jenkinsci.plugins.workflow.cps.CpsThreadGroup
Caused: java.lang.IllegalStateException: FlowHead loading problem at deserialize: Null FlowHead with id 4 in execution CpsFlowExecution[Owner[p/1:p #1]]
	at org.jenkinsci.plugins.workflow.cps.FlowHead.readResolve(FlowHead.java:207)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callReadResolve(JDKSpecific.java:213)
	at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:311)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1422)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
	at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
	at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:531)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:498)
	at java.base/java.util.HashMap.readObject(HashMap.java:1560)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callReadObject(JDKSpecific.java:171)
	at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:252)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1808)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
	at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
	at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:531)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:498)
	at com.cloudbees.groovy.cps.SerializableScript.readObject(SerializableScript.java:30)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callReadObject(JDKSpecific.java:171)
	at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:252)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1808)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1777)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
	at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
	at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:531)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:498)
	at java.base/java.util.HashMap.readObject(HashMap.java:1560)
	at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callReadObject(JDKSpecific.java:171)
	at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:252)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1808)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:246)
	at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1918)
	at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1831)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1421)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:231)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:331)
	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader$SandboxedUnmarshaller.sandbox(RiverReader.java:250)
	at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader$SandboxedUnmarshaller.readObject(RiverReader.java:263)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$2.onSuccess(CpsFlowExecution.java:879)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$2.onSuccess(CpsFlowExecution.java:872)
	at org.jenkinsci.plugins.workflow.support.concurrent.Futures$1.run(Futures.java:147)
	at org.jenkinsci.plugins.workflow.support.concurrent.DirectExecutor.execute(DirectExecutor.java:33)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1286)
	at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:760)
	at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:157)
	at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:97)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.loadProgramAsync(CpsFlowExecution.java:869)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:836)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:719)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:577)
	at hudson.model.RunMap.retrieve(RunMap.java:233)
	at hudson.model.RunMap.retrieve(RunMap.java:61)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:657)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:639)
	at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:537)
	at hudson.model.RunMap.getById(RunMap.java:213)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.run(WorkflowRun.java:968)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.get(WorkflowRun.java:980)
	at org.jenkinsci.plugins.workflow.flow.FlowExecutionList.resume(FlowExecutionList.java:226)
	at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ItemListenerImpl.onLoaded(FlowExecutionList.java:217)
	at jenkins.model.Jenkins.<init>(Jenkins.java:1045)
	at hudson.model.Hudson.<init>(Hudson.java:86)
	at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:746)
	at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:408)
	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:649)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.lang.Thread.run(Thread.java:1583)
ERROR: Failed to load program
Finished: FAILURE

new DepthFirstScanner().allNodes(b.getExecution()).stream().sorted(Comparator.comparing(n -> Integer.valueOf(n.getId()))).forEach(n -> System.out.println(n.getId() + " " + n.getDisplayName()));
});
}

}