[ISSUE #10747] Fix InvokeCallback completion order - #10753
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Restructures invokeAsyncImpl to guarantee that outcome callbacks (operationSucceed/operationFail) are always invoked before the completion callback (operationComplete), and wraps both in try-catch to prevent one failure from blocking the other.
Findings
- [Info]
NettyRemotingAbstract.java:680-707— The singlewhenCompletehandler replaces the previousthenAccept/exceptionallychain, eliminating the ordering ambiguity. Outcome callback is now explicitly called first, then completion callback. - [Info] The try-catch around each callback invocation ensures that a misbehaving callback cannot prevent the other from executing. This is important for cleanup paths.
- [Info]
NettyRemotingClientTest.java— Tests now verify callback ordering withInOrderand cover the case where a callback throws. The newtestInvokeAsyncCompleteFailureDoesNotInvokeFailureCallbacktest validates thatoperationFailreceives the correct exception instance.
Suggestions
- Consider adding a brief comment in the
whenCompletehandler explaining why outcome must precede completion (contract: callers may depend on outcome state inoperationComplete).
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Defensive fix with proper validation and test coverage. LGTM.
Automated review by github-manager-bot
Signed-off-by: Rui <1685901819@qq.com>
ecb9ace to
4a6b17c
Compare
|
Status refresh (2026-08-28):
The PR remains compatible with current |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10753 +/- ##
=============================================
- Coverage 48.58% 48.50% -0.08%
+ Complexity 13676 13648 -28
=============================================
Files 1381 1381
Lines 101475 101479 +4
Branches 13190 13191 +1
=============================================
- Hits 49299 49220 -79
- Misses 46174 46246 +72
- Partials 6002 6013 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
All 10 CI checks are green on the refreshed single signed-off commit. @drpmma @aaron-ai, could you please take a human review when convenient? The key point is preserving the |
Which Issue(s) This PR Fixes
Brief Description
invokeAsyncImpl()chainedwhenComplete,thenAccept, andexceptionally. This causedoperationCompleteto run beforeoperationSucceedoroperationFail, contrary to theInvokeCallbackcontract, and allowed exceptions thrown by callback methods to flow into the invocation-failure stage.The fix handles the original invocation result in one terminal
whenCompletecallback:operationSucceedoroperationFailbeforeoperationComplete;finally, including when the outcome callback throws.Callback exceptions are caught and logged locally because
invokeAsyncImpl()returnsvoidand does not expose the dependent completion stage. This guarantees thatoperationCompletestill runs and prevents callback failures from being misclassified as remoting invocation failures.How Did You Test This Change?
develop: the deterministic callback-order regression failed in 5/5 isolated JDK 8 Maven processes.git diff --check: passed.