Skip to content

Commit

Permalink
Do not throw in task enqueued by CancellableRunner (#112780)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ywangd authored and davidkyle committed Sep 12, 2024
1 parent 9f5b528 commit 6fdb78c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ tests:
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testCorruption
issue: https://github.com/elastic/elasticsearch/issues/112769
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testTransportException
issue: https://github.com/elastic/elasticsearch/issues/112779
- class: org.elasticsearch.script.StatsSummaryTests
method: testEqualsAndHashCode
issue: https://github.com/elastic/elasticsearch/issues/112439
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,11 @@ public void onResponse(Releasable releasable) {
if (cancellableThreads.isCancelled()) {
runnable.onFailure(new TaskCancelledException("task cancelled"));
} else {
cancellableThreads.execute(runnable::run);
try {
cancellableThreads.execute(runnable::run);
} catch (RuntimeException e) {
runnable.onFailure(e);
}
}
}
}
Expand Down

0 comments on commit 6fdb78c

Please sign in to comment.