RockteMQ-AI commented on issue #10898:
URL: https://github.com/apache/rocketmq/issues/10898#issuecomment-5238103181

   **Issue Evaluation**
   
   Category: `type/enhancement` | Status: **Evaluated**
   
   **Feasibility:** Feasible
   **Scope:** `remoting` module — `NettyRemotingAbstract.NettyEventExecutor`
   **Compatibility:** No breaking changes
   
   Verified against the current codebase on `develop`:
   
   - `NettyEventExecutor.run()` blocks on `eventQueue.poll(3000, 
TimeUnit.MILLISECONDS)` — a `LinkedBlockingQueue` operation.
   - `ServiceThread.wakeup()` calls `LockSupport.unpark(this.thread)`, which 
only releases threads parked via `LockSupport.park()` (i.e., inside 
`waitForRunning`). It has no effect on a thread blocked in 
`LinkedBlockingQueue.poll()`.
   - Result: each `NettyEventExecutor` instance waits up to 3 seconds after 
`shutdown()` before observing the `stopped` flag. With multiple remoting 
instances per `BrokerController`, the cost accumulates linearly.
   
   The proposed fix — overriding `wakeup()` to offer a sentinel event to 
`eventQueue` — is a clean and minimal solution. The sentinel is compared by 
reference in the dispatch loop, so no listener callback is triggered and no new 
`NettyEventType` constant is needed.
   
   The measured improvement (BrokerShutdownTest: 71.98s → 53.63s, per-instance 
join: ~3000ms → 0ms) is consistent with the analysis.
   
   ---
   *Automated evaluation by github-manager*
   


-- 
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]

Reply via email to