Skip to content

Commit 8034dd2

Browse files
committed
https://github.com/jenkinsci/workflow-api-plugin/pull/221#discussion_r882853693
Example from `ExecutorStepDynamicContextTest.parallelNodeDisappearance`: ``` "Computer.threadPoolForRemoting [#3]" #89 daemon prio=5 os_prio=0 tid=0x00007f30d0c6a800 nid=0x6d0f9 in Object.wait() [0x00007f31047fe000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:460) at hudson.remoting.AsyncFutureImpl.get(AsyncFutureImpl.java:97) - locked <0x00000000f83dd1e8> (a hudson.remoting.AsyncFutureImpl) at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepDynamicContext.resume(ExecutorStepDynamicContext.java:108) at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution.onResume(ExecutorStepExecution.java:201) at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ParallelResumer.lambda$run$5(FlowExecutionList.java:369) at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ParallelResumer$$Lambda$350/265274739.run(Unknown Source) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at … ```
1 parent a643c5f commit 8034dd2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/org/jenkinsci/plugins/workflow/flow/FlowExecutionList.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import hudson.XmlFile;
1313
import hudson.init.InitMilestone;
1414
import hudson.init.Terminator;
15+
import hudson.model.Computer;
1516
import hudson.model.listeners.ItemListener;
1617
import hudson.remoting.SingleLaneExecutorService;
1718
import hudson.util.CopyOnWriteList;
@@ -359,7 +360,10 @@ synchronized void run() {
359360
FlowNode n = entry.getKey();
360361
StepExecution exec = entry.getValue();
361362
processing.add(n);
362-
Timer.get().submit(() -> {
363+
// Strictly speaking threadPoolForRemoting should be used for agent communications.
364+
// In practice the onResume impl known to block is in ExecutorStepExecution.
365+
// Avoid jenkins.util.Timer since it is capped at 10 threads and should not be used for long tasks.
366+
Computer.threadPoolForRemoting.submit(() -> {
363367
LOGGER.fine(() -> "About to resume " + n + " ~ " + exec);
364368
try {
365369
exec.onResume();

0 commit comments

Comments
 (0)