Skip to content

Commit e22bef6

Browse files
authored
Do not throw in task enqueued by CancellableRunner (elastic#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: elastic#112779
1 parent 19e9b2f commit e22bef6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ tests:
211211
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
212212
method: testCorruption
213213
issue: https://github.com/elastic/elasticsearch/issues/112769
214-
- class: org.elasticsearch.repositories.blobstore.testkit.integrity.RepositoryVerifyIntegrityIT
215-
method: testTransportException
216-
issue: https://github.com/elastic/elasticsearch/issues/112779
217214
- class: org.elasticsearch.script.StatsSummaryTests
218215
method: testEqualsAndHashCode
219216
issue: https://github.com/elastic/elasticsearch/issues/112439

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)