[ISSUE #11091] Fix remoting sub-server timeout scanning and scheduler shutdown - #11092
Open
qianye1001 wants to merge 1 commit into
Open
[ISSUE #11091] Fix remoting sub-server timeout scanning and scheduler shutdown#11092qianye1001 wants to merge 1 commit into
qianye1001 wants to merge 1 commit into
Conversation
…eduler shutdown
RockteMQ-AI
approved these changes
Sep 9, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
Correct fix for two resource-leak bugs in the remoting layer. The housekeeping timer now scans all registered servers (parent + sub-servers), preventing async requests from hanging indefinitely. The scheduler is properly shut down, preventing thread leaks after server shutdown.
Findings
- [Info]
NettyRemotingServer.java:268— The loopfor (NettyRemotingAbstract server : remotingServerTable.values())correctly ensures all sub-servers' response tables are scanned. The variable nameservershadows the outer class instance, but the scope is small and the intent is clear. - [Info]
NettyRemotingServer.java:339— Addingthis.scheduledExecutorService.shutdown()in the shutdown path is correct and prevents the scheduler thread from surviving server shutdown. The placement aftertimer.stop()maintains the existing shutdown order. - [Info] The lifecycle test is well-structured — it covers timeout scanning across parent + 2 sub-servers, verifies response table cleanup, async permit release, and scheduler termination. The
tearDownmethod defensively cleans up even if the shutdown test fails on unfixed code.
Verdict
LGTM. Both fixes are minimal, targeted, and well-tested. The changes address real resource leaks that could cause request hangs and thread accumulation in long-running brokers.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #11092 +/- ##
=============================================
- Coverage 48.92% 48.89% -0.03%
+ Complexity 13846 13842 -4
=============================================
Files 1382 1382
Lines 101602 101605 +3
Branches 13213 13214 +1
=============================================
- Hits 49709 49682 -27
- Misses 45866 45885 +19
- Partials 6027 6038 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Fixes #11091
Brief Description
Server-initiated async requests through a
SubRemotingServercan remain pending indefinitely after a successful write if no response arrives: the shared housekeeping timer scans only the parent response table. Scan every registered remoting server with the existing timer so expired requests trigger timeout callbacks and release their response-table entries and async permits.Also shut down the remoting-code distribution scheduler when the parent server shuts down, preventing its periodic task and
NettyServerSchedulerthread from surviving server shutdown. No additional threads are introduced.How Did You Test This Change?
develop: the sub-server timeout callback never completed, and the scheduler remained running after shutdown.mvn -pl remoting -am -Dtest=NettyRemotingServerLifecycleTest,NettyRemotingServerTest,SubRemotingServerTest,RemotingServerTest,NettyRemotingAbstractTest -Dsurefire.failIfNoSpecifiedTests=false test, including Checkstyle and SpotBugs.