Skip to content

Commit 7f65cc8

Browse files
authored
Merge pull request #837 from jglick/croak
More robust `CpsFlowExecution.croak`
2 parents 50a4b14 + 480c4e2 commit 7f65cc8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,19 @@ private void loadProgramFailed(final Throwable problem, SettableFuture<CpsThread
912912
/** Report a fatal error in the VM. */
913913
void croak(Throwable t) {
914914
setResult(Result.FAILURE);
915-
onProgramEnd(new Outcome(null, t));
915+
boolean noStartNodes;
916+
synchronized (this) {
917+
noStartNodes = startNodes == null || startNodes.isEmpty();
918+
}
919+
if (noStartNodes) {
920+
try {
921+
createPlaceholderNodes(t);
922+
} catch (Exception x) {
923+
LOGGER.log(Level.WARNING, "Failed to create placeholder nodes in " + owner, x);
924+
}
925+
} else {
926+
onProgramEnd(new Outcome(null, t));
927+
}
916928
cleanUpHeap();
917929
try {
918930
saveOwner();

0 commit comments

Comments
 (0)