[ISSUE #10898] Wake NettyEventExecutor immediately on shutdown - #10915
[ISSUE #10898] Wake NettyEventExecutor immediately on shutdown#10915123123213weqw wants to merge 2 commits into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR adds two improvements to NettyRemotingAbstract:
- Null check for
event.getType()— defensive programming to prevent NPE if a null event type is somehow queued. shutdown()override — wakes up the event queue poll immediately by offering a sentinelNettyEvent, so the executor observes the stopped flag without waiting for the 3-second poll timeout.
Both changes are correct and improve shutdown responsiveness. LGTM.
Note: This PR also includes the PopConsumerRocksdbStore fix from #10914. Consider coordinating with maintainers to avoid merge conflicts with the other PRs in this series (#10914-#10923).
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review Summary
This PR fixes slow shutdown in NettyRemotingAbstract by waking the NettyEventExecutor immediately when shutdown is requested.
Findings
- [Critical] NettyRemotingAbstract.java — The original code would wait for the polling thread to wake up naturally, causing slow shutdown. The fix overrides
shutdownto offer a sentinel event to the queue, waking the thread immediately. - [Info] The null check for event type is also a good defensive addition.
Overall
Good fix for shutdown latency. This is especially important for graceful shutdown scenarios where timely cleanup is critical.
Automated review by RockteMQ-AI
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Two improvements to NettyEventExecutor:
- Null-check on event.getType() prevents NPE from the sentinel event
- Override shutdown() to offer a sentinel event, waking the thread blocked on eventQueue.poll()
This ensures shutdown is responsive instead of waiting up to 3 seconds for the poll timeout. LGTM.
Automated review by github-manager-bot
What is the purpose of the change
Fix #10898.
NettyEventExecutor blocks in eventQueue.poll(3000, MILLISECONDS), but ServiceThread.shutdown() only signals the stopped flag and calls wakeup(), which unparks a parked thread and cannot release a thread blocked on a LinkedBlockingQueue. Every shutdown of a remoting instance therefore waited up to 3 seconds per NettyEventExecutor.
Brief changelog
How was this patch verified
git diff --checkclean