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

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase at commit 
`a06836d`.
   
   **Root Cause:** In `NettyRemotingAbstract.invokeAsyncImpl()` (line 677), the 
`CompletableFuture` chain calls `operationComplete` via `whenComplete` 
**before** `operationSucceed`/`operationFail` (via 
`thenAccept`/`exceptionally`). This violates the documented contract in 
`InvokeCallback.operationComplete` Javadoc:
   
   > *This method is expected to be invoked after `operationSucceed` or 
`operationFail`*
   
   For comparison, `ResponseFuture.executeInvokeCallback()` (line 62) correctly 
follows the documented order: `operationSucceed`/`operationFail` first, then 
`operationComplete`.
   
   **Impact:** Callers relying on the callback contract to publish the request 
outcome before final completion/cleanup will observe incorrect ordering. 
Additionally, exceptions thrown by `operationComplete` are incorrectly routed 
to `operationFail`, masking the real success outcome.
   
   **Severity:** High — affects callback contract integrity in the remoting 
layer, which is foundational for async operations across Broker, Proxy, and 
client communication.
   
   **Suggested fix direction:** Replace the chained `whenComplete` → 
`thenAccept` → `exceptionally` with a single terminal `whenComplete` that:
   1. On success: invoke `operationSucceed` then `operationComplete`
   2. On failure: invoke `operationFail` then `operationComplete`
   3. Isolate callback exceptions from invocation outcome routing
   
   An automated fix proposal will be generated. Reply `/approve` to proceed 
with PR generation.
   
   ---
   *Automated evaluation by RockteMQ-AI*


-- 
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