From 037f5c038aefbabe0afef49bcfa11bc1a36d3712 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 7 Nov 2024 13:23:25 -0500 Subject: [PATCH 1/2] Always call `super` from `WorkflowRun.onLoad` --- .../java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java index 8221224a..44d0b35b 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java @@ -556,6 +556,7 @@ private String key() { } @Override protected void onLoad() { + super.onLoad(); try { synchronized (getMetadataGuard()) { if (executionLoaded) { @@ -563,8 +564,6 @@ private String key() { return; } boolean needsToPersist = completed == null; - super.onLoad(); - if (Boolean.TRUE.equals(completed) && result == null) { LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for "+this); setResult(Result.FAILURE); From 21749d78d33ecdfe054a57884eb2975432033c2b Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 7 Nov 2024 13:42:49 -0500 Subject: [PATCH 2/2] Include a stack trace in the double-`onLoad` scenario --- .../java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java index 44d0b35b..4002dba5 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java @@ -560,7 +560,7 @@ private String key() { try { synchronized (getMetadataGuard()) { if (executionLoaded) { - LOGGER.log(Level.WARNING, "Double onLoad of build "+this); + LOGGER.log(Level.WARNING, "Double onLoad of build " + this, new Throwable()); return; } boolean needsToPersist = completed == null;