Skip to content

Commit 8d87b1c

Browse files
[8.x] Do not throw in task enqueued by CancellableRunner (#112780) (#112786)
* Do not throw in task enqueued by CancellableRunner (#112780) CancellableThreads#excute can throw runtime exception including cancellation. This does not work with AbstractThrottledTaskRunner which expects enqueued task to _not_ throw. This PR catches any runtime exception from CancellableThreads and hand it back to the original runnable. Resolves: #112779 (cherry picked from commit e22bef6) # Conflicts: # muted-tests.yml * Update muted-tests.yml * Update muted-tests.yml --------- Co-authored-by: Elastic Machine <[email protected]>
1 parent 6067464 commit 8d87b1c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RepositoryIntegrityVerifier.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,11 @@ public void onResponse(Releasable releasable) {
934934
if (cancellableThreads.isCancelled()) {
935935
runnable.onFailure(new TaskCancelledException("task cancelled"));
936936
} else {
937-
cancellableThreads.execute(runnable::run);
937+
try {
938+
cancellableThreads.execute(runnable::run);
939+
} catch (RuntimeException e) {
940+
runnable.onFailure(e);
941+
}
938942
}
939943
}
940944
}

0 commit comments

Comments
 (0)