[ISSUE #10739] Complete proxy futures when processor executors reject tasks - #10740
[ISSUE #10739] Complete proxy futures when processor executors reject tasks#10740ai-yang wants to merge 1 commit into
Conversation
Signed-off-by: Rui <1685901819@qq.com>
5780823 to
4d8997c
Compare
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Findings
-
[Info]
FutureUtils.java:27-34— The fix is correct.completionFuture.whenComplete(...)runs synchronously in the completing thread (not submitted to the executor), so it reliably catchesRejectedExecutionExceptionwithout needing another executor. Good design. -
[Info]
DefaultMessagingProcessor.java:89,98— Switching from the defaultDiscardOldestPolicytoAbortPolicyis the right call here. Under high load or shutdown, tasks that were previously silently discarded will now surface asRejectedExecutionException, whichFutureUtilscan properly propagate. This is a behavioral change, but it converts silent data loss into explicit failure — the correct tradeoff for a messaging system. -
[Info]
FutureUtilsTest.java— Test coverage is solid. The shut-down executor pattern reliably reproduces the rejection scenario, and assertingCompletionExceptionwrappingRejectedExecutionExceptionvalidates the full propagation chain. -
[Info]
DefaultMessagingProcessorTest.java— Good integration-level test that verifies the real executor chain propagates rejections through the future.
Suggestions
- Minor: Consider whether other thread pools in the Proxy module that also use
appendNextFuture(or similar future-chaining patterns) might need the sameAbortPolicytreatment. A quick audit ofThreadPoolMonitor.createAndMonitorcall sites in the proxy module could reveal similar latent issues.
Verdict
Well-structured bug fix that addresses both the symptom (pending futures) and root cause (silent task discarding). The two-level approach ensures robustness even if one layer is misconfigured.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
FutureUtils.appendNextFuturenow retains the stage returned bywhenCompleteAsyncand propagates completion-task scheduling failures to the future returned to the caller.The Proxy producer and consumer processor executors now use an explicit
AbortPolicy. This is required because the shared defaultDiscardOldestPolicycan silently discard completion tasks during shutdown or saturation, leaving no rejection forFutureUtilsto propagate. Other RocketMQ thread pools keep their existing rejection behavior.Together, these changes ensure that Proxy request futures reach an exceptional terminal state instead of remaining pending when processor completion work is rejected.
How Did You Test This Change?
RejectedExecutionExceptionand cover both Proxy producer and consumer pools. Twenty isolated JUnit processes passed all 6 tests each (120/120).proxy -amtest reactor: all 11 modules succeeded in 33:50; Broker ran 752 tests (0 failures, 0 errors, 4 skipped) and Proxy ran 304 tests (0 failures, 0 errors, 3 skipped).common,proxyMavenvalidate: both modules passed with 0 Checkstyle violations.git diff --check: passed.