-
Notifications
You must be signed in to change notification settings - Fork 200
Be quieter handling CpsFlowExecution.owner == null in suspendAll
#788
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1638,25 +1638,23 @@ public void pause(final boolean v) throws IOException { | |
| @Restricted(DoNotUse.class) | ||
| @Terminator(attains = FlowExecutionList.EXECUTIONS_SUSPENDED) | ||
| public static void suspendAll() { | ||
| CpsFlowExecution exec = null; | ||
| try (Timeout t = Timeout.limit(3, TimeUnit.MINUTES)) { // TODO some complicated sequence of calls to Futures could allow all of them to run in parallel | ||
| LOGGER.fine("starting to suspend all executions"); | ||
| for (FlowExecution execution : FlowExecutionList.get()) { | ||
| try { | ||
| if (execution instanceof CpsFlowExecution) { | ||
| CpsFlowExecution cpsExec = (CpsFlowExecution)execution; | ||
| if (execution instanceof CpsFlowExecution) { | ||
| CpsFlowExecution cpsExec = (CpsFlowExecution) execution; | ||
| try { | ||
| cpsExec.checkAndAbortNonresumableBuild(); | ||
|
|
||
| LOGGER.log(Level.FINE, "waiting to suspend {0}", execution); | ||
| exec = (CpsFlowExecution) execution; | ||
| // Like waitForSuspension but with a timeout: | ||
| if (exec.programPromise != null) { | ||
| if (cpsExec.programPromise != null) { | ||
|
Comment on lines
-1645
to
+1651
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simplifying |
||
| LOGGER.log(Level.FINER, "Waiting for Pipeline to go to sleep for shutdown: "+execution); | ||
| try { | ||
| exec.programPromise.get(1, TimeUnit.MINUTES).scheduleRun().get(1, TimeUnit.MINUTES); | ||
| cpsExec.programPromise.get(1, TimeUnit.MINUTES).scheduleRun().get(1, TimeUnit.MINUTES); | ||
| LOGGER.log(Level.FINER, " Pipeline went to sleep OK: "+execution); | ||
| } catch (InterruptedException | TimeoutException ex) { | ||
| LOGGER.log(Level.WARNING, "Error waiting for Pipeline to suspend: "+exec, ex); | ||
| LOGGER.log(Level.WARNING, "Error waiting for Pipeline to suspend: " + cpsExec, ex); | ||
| } | ||
| } | ||
| cpsExec.checkpoint(true); | ||
|
|
@@ -1671,15 +1669,15 @@ public static void suspendAll() { | |
| } | ||
| }); | ||
| } | ||
| cpsExec.getOwner().getListener().getLogger().close(); | ||
| if (cpsExec.owner != null) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. main fix
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any idea how this would be reachable? Corruption during resumption or something? Perhaps jenkinsci/workflow-api-plugin#304 has made it possible? If I understand right, in this case
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am afraid I do not know—just saw this in a log.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what it's worth though I saw another case of a I looked at the XML for that execution on disk (based on the thread name) and |
||
| cpsExec.owner.getListener().getLogger().close(); | ||
| } | ||
| } catch (Exception ex) { | ||
| LOGGER.log(Level.WARNING, "Error persisting Pipeline execution at shutdown: " + cpsExec.owner, ex); | ||
| } | ||
| } catch (Exception ex) { | ||
| LOGGER.log(Level.WARNING, "Error persisting Pipeline execution at shutdown: "+((CpsFlowExecution) execution).owner, ex); | ||
| } | ||
| } | ||
| LOGGER.fine("finished suspending all executions"); | ||
| } catch (Exception x) { | ||
| LOGGER.log(Level.WARNING, "problem suspending " + exec, x); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Outermost
catchclause seemed redundant. (Timeout.closedoes not throw exceptions, so it was not for that.)