Skip to content

Commit

Permalink
dcache-bulk: fix warning for premature stop of job container
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alrossi committed Sep 11, 2023
1 parent 17453da commit 1266bb7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ public void run() {
containerState = ContainerState.STOP;
update(COMPLETED);
break;
case STOP:
LOGGER.debug("run {} was prematurely stopped; exiting", ruid);
update(CANCELLED);
setRunThread(null);
return;
default:
throw new RuntimeException(
"run container called with container in wrong state " + containerState
Expand Down

0 comments on commit 1266bb7

Please sign in to comment.