Skip to content

Commit 1266bb7

Browse files
committed
dcache-bulk: fix warning for premature stop of job container
Motivation: On cancellation, it is possible to see: 08 Sep 2023 08:22:24 [pool-8-thread-19] [] Uncaught exception in thread pool-8-thread-19java.lang.RuntimeException: run container called with container in wrong state STOP; this is a bug. at org.dcache.services.bulk.job.AbstractRequestContainerJob.run(AbstractRequestContainerJob.java:330) at org.dcache.util.FireAndForgetTask.run(FireAndForgetTask.java:28) at org.dcache.util.CDCExecutorServiceDecorator$WrappedRunnable.run(CDCExecutorServiceDecorator.java:130) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131) at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75) at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82) at org.dcache.util.BoundedExecutor$Worker.run(BoundedExecutor.java:247) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) While this error would be appropriate for other states, it is possible to encounter a run `STOP` state upon (re)calling `run()` now that listing is multithreaded. Modification: Log the condition and exit. Result: Avoids stack traces which are not really from a bug but from a multithreaded cancel. Target: master Patch: https://rb.dcache.org/r/14093/ Requires-notes: no (unreleased change in https://rb.dcache.org/r/14041/) Ackec-by: Tigran
1 parent 17453da commit 1266bb7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/dcache-bulk/src/main/java/org/dcache/services/bulk/job/AbstractRequestContainerJob.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ public void run() {
326326
containerState = ContainerState.STOP;
327327
update(COMPLETED);
328328
break;
329+
case STOP:
330+
LOGGER.debug("run {} was prematurely stopped; exiting", ruid);
331+
update(CANCELLED);
332+
setRunThread(null);
333+
return;
329334
default:
330335
throw new RuntimeException(
331336
"run container called with container in wrong state " + containerState

0 commit comments

Comments
 (0)