wang-jiahua opened a new pull request, #11005:
URL: https://github.com/apache/rocketmq/pull/11005
### Which Issue(s) This PR Fixes
Fixes #10898
### Brief Description
`NettyEventExecutor` blocks in `eventQueue.poll(3000ms)` instead of
`waitForRunning`, so the `LockSupport.unpark` performed by
`ServiceThread.shutdown()` cannot release it: the thread only notices the
stopped flag once the poll expires, and every shutdown of a remoting instance
pays up to 3 seconds for nothing.
This PR overrides `wakeup()` to offer a sentinel `NettyEvent` into the queue
after `super.wakeup()`, making the blocking poll return immediately; the
dispatch loop skips the sentinel. No behavior change apart from the faster exit.
### How Did You Test This Change?
- New deterministic test
`testNettyEventExecutorShutdownDoesNotWaitForPollTimeout`: on current develop
it fails after 3.66s (the thread waits out the full poll timeout); with this
patch it passes in under 1s. `NettyRemotingAbstractTest` 6/6, checkstyle clean.
- Server-side isolated A/B on an 8C32G ECS (Dragonwell 21), driving
`NettyEventExecutor` start/shutdown directly, 5 runs per arm:
- base (current jar): 2700.3 / 2700.4 / 2700.3 / 2700.3 / 2700.3 ms
- patched: 0.4 / 0.3 / 0.2 / 0.2 / 0.2 ms
- No commercial/extension code references `NettyEventExecutor` (inner class,
package-private).
--
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]