Skip to content

Commit 0d687ec

Browse files
committed
fix: propagate runAsync dispatch failure into retryFuture
If ForkJoinPool.commonPool() rejects the retry task (e.g. during JVM shutdown), the runAsync future completes exceptionally but retryFuture was never completed, causing the overall request future to hang. Wire an .exceptionally() handler on the runAsync future so any dispatch failure propagates into retryFuture immediately.
1 parent d1c52e0 commit 0d687ec

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

api/src/main/java/io/minio/BaseS3Client.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,18 @@ private CompletableFuture<Response> executeWithRetry(
321321
RETRY_SCHEDULER.schedule(
322322
() ->
323323
CompletableFuture.runAsync(
324-
() ->
325-
executeWithRetry(s3request, region, maxAttempts, attempt + 1)
326-
.whenComplete(
327-
(r, t) -> {
328-
if (t != null) retryFuture.completeExceptionally(t);
329-
else retryFuture.complete(r);
330-
})),
324+
() ->
325+
executeWithRetry(s3request, region, maxAttempts, attempt + 1)
326+
.whenComplete(
327+
(r, t) -> {
328+
if (t != null) retryFuture.completeExceptionally(t);
329+
else retryFuture.complete(r);
330+
}))
331+
.exceptionally(
332+
ex -> {
333+
retryFuture.completeExceptionally(ex);
334+
return null;
335+
}),
331336
delayMs,
332337
TimeUnit.MILLISECONDS);
333338
return retryFuture;

0 commit comments

Comments
 (0)