Skip to content

Commit

Permalink
Do not throw in task enqueued by CancellableRunner (elastic#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: elastic#112779
(cherry picked from commit e22bef6)

# Conflicts:
#	muted-tests.yml
  • Loading branch information
ywangd committed Sep 12, 2024
1 parent f217322 commit ffd4a2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ tests:
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/cluster/stats/line_1450}
issue: https://github.com/elastic/elasticsearch/issues/112732
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
method: testCorruption
issue: https://github.com/elastic/elasticsearch/issues/112769
- class: org.elasticsearch.script.StatsSummaryTests
method: testEqualsAndHashCode
issue: https://github.com/elastic/elasticsearch/issues/112439

# Examples:
#
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 ffd4a2e

Please sign in to comment.