RockteMQ-AI commented on issue #10739:
URL: https://github.com/apache/rocketmq/issues/10739#issuecomment-5150956800

   **Fix Spec (v1)**
   
   **Problem:** `FutureUtils.appendNextFuture()` calls 
`future.whenCompleteAsync(callback, executor)` but ignores the returned 
`CompletableFuture<Void>`. If the executor rejects the callback task 
(shutdown/saturation), `nextFuture` is never completed — leaving Proxy request 
futures pending indefinitely.
   
   **Proposed Fix:** Capture the dependent stage and attach an `exceptionally` 
handler to propagate rejection into `nextFuture`:
   
   ```java
   CompletableFuture<Void> stage = future.whenCompleteAsync((t, throwable) -> {
       if (throwable != null) {
           nextFuture.completeExceptionally(throwable);
       } else {
           nextFuture.complete(t);
       }
   }, executor);
   stage.exceptionally(ex -> {
       nextFuture.completeExceptionally(ex);
       return null;
   });
   ```
   
   **Files to modify:**
   - `common/src/main/java/org/apache/rocketmq/common/utils/FutureUtils.java`
   
   **Test plan:** Add `FutureUtilsTest` verifying the returned future completes 
exceptionally when the executor rejects the task.
   
   **Risk:** Minimal — only adds exception propagation for the 
rejected-executor edge case. Normal path unchanged. No call-site modifications 
needed.
   
   ---
   Reply `/approve` to proceed with PR generation | `/revise <feedback>` to 
request changes | `/reject` to decline.
   
   ---
   *Automated fix proposal by github-manager-bot*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to