iloveeyjafjalla opened a new pull request, #11394:
URL: https://github.com/apache/rocketmq/pull/11394

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11393
   
   ### Brief Description
   
   `DefaultReceiptHandleManager` creates `renewalWorkerService` and 
`returnHandleGroupWorkerService` for itself, but its
   lifecycle hook only stopped the scheduler and cleared the handles:
   
   ```java
   public void shutdown() throws Exception {
       scheduledExecutorService.shutdown();
       clearAllHandle();
   }
   ```
   
   Neither pool is shut down anywhere in the repository, and their threads are 
not daemons, so a proxy shutdown that happens
   inside a living JVM (embedded use, integration tests, an in-process restart) 
left up to `renewThreadPoolNums +
   returnHandleGroupThreadPoolNums` threads and their queued renew/return tasks 
running against services that were being torn
   down.
   
   The change shuts both pools down at the end of the manager's shutdown. The 
order matters and is kept: `clearAllHandle()`
   submits the remaining handles to `returnHandleGroupWorkerService`, so the 
pools are stopped after that call and the queued
   handovers still run.
   
   ### How Did You Test This Change?
   
   New test `DefaultReceiptHandleManagerTest#testShutdownStopsTheWorkerPools`: 
it builds the manager the same way the other
   tests in the class do, calls `shutdown()`, and asserts that 
`renewalWorkerService.isShutdown()` and
   `returnHandleGroupWorkerService.isShutdown()` are true.
   
   Results on Temurin JDK 8 (same JDK as CI), base `a7edeecfb` plus this patch:
   
   - before the fix: `java.lang.AssertionError` on the first pool assertion 
(still running after `shutdown()`)
   - after the fix: `DefaultReceiptHandleManagerTest` — 13 tests, 0 failures
   - `mvn -B -ntp -pl proxy package` with checkstyle + spotbugs enabled: `BUILD 
SUCCESS`, spotbugs `BugInstance size is 0`
   
   This change was prepared with AI assistance (analysis, patch and test 
drafting); the diff and every result above were
   reproduced locally by running the module's tests against the base commit and 
the patched tree.
   


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