Skip to content

Commit

Permalink
dcache-bulk: handle InterruptedException in DirListTask
Browse files Browse the repository at this point in the history
Motivation:

https://rb.dcache.org/r/14041/
`master@2acfaf8`
introduced multithreaded concurrent listing
using a `DirListTask`.

During cancellation, this stack trace may
occur repeatedly:

```
pool-13-thread-24] [] Uncaught exception in thread pool-13-thread-24java.lang.InterruptedException: null
	at org.dcache.services.bulk.job.AbstractRequestContainerJob.checkForRequestCancellation(AbstractRequestContainerJob.java:396)
	at org.dcache.services.bulk.job.RequestContainerJob.perform(RequestContainerJob.java:257)
	at org.dcache.services.bulk.job.RequestContainerJob.handleFileTarget(RequestContainerJob.java:191)
	at org.dcache.services.bulk.job.AbstractRequestContainerJob$1.doList(AbstractRequestContainerJob.java:442)
	at org.dcache.services.bulk.job.AbstractRequestContainerJob$DirListTask.run(AbstractRequestContainerJob.java:146)
	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)
```

This is due to the fact that the InterruptedException
generated by the cancellation is not handled separately
in the wrapped `DirListTask`.

Modification:

Treat the InterruptedException as a special case, as it
should be.

Result:

No more cluttering of the log file when jobs with
ongoing listing activity are cancelled.

Target: master
Patch: https://rb.dcache.org/r/14091/
Requires-notes: no (unreleased changes)
Acked-by: Tigran
  • Loading branch information
alrossi committed Sep 8, 2023
1 parent 41f34d8 commit 49cf406
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -144,6 +144,10 @@ abstract class DirListTask implements Runnable {
public void run() {
try {
doList();
} catch (InterruptedException e) {
containerState = ContainerState.STOP;
target.setErrorObject(e);
update(CANCELLED);
} catch (Throwable e) {
errorHandler.accept(e);
Throwables.throwIfUnchecked(e);
Expand Down

0 comments on commit 49cf406

Please sign in to comment.