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

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported flaky test issue has been verified against the current codebase 
on `develop` branch.
   
   **Root Cause Analysis:**
   
   The race condition is in `DefaultReceiptHandleManagerTest#testClientOffline`:
   
   1. `CLIENT_UNREGISTER` triggers `clearGroup()` which removes the group from 
`receiptHandleGroupMap` synchronously, then submits `returnHandleGroup()` to 
the async worker thread.
   2. `returnHandleGroup()` iterates handles and calls 
`eventListener.fireEvent()` which calls 
`messagingProcessor.changeInvisibleTime(...).whenComplete(...)`.
   3. In `testClientOffline()`, `changeInvisibleTime()` is **not stubbed** for 
this cleanup path. Mockito returns `null`, causing `NullPointerException` on 
`.whenComplete()`.
   4. The NPE prevents the handle from being removed from the group. Since the 
group remains non-empty, `returnHandleGroup()` calls `putIfAbsent()` which 
**re-inserts** the group into `receiptHandleGroupMap`.
   5. The test immediately asserts `receiptHandleGroupMap.isEmpty()` after 
triggering the event, making the assertion dependent on async thread scheduling.
   
   **Impact:** Test reliability in CI (Coverage workflow). Intermittent 
failures block CI pipelines.
   
   **Severity:** Medium - test-only issue, no production behavior impact.
   
   **Proposed Fix Assessment:** The author's proposed test-only fix is 
appropriate:
   - Stub `changeInvisibleTime()` with a completed `CompletableFuture` for the 
cleanup path
   - Use Awaitility to wait for async cleanup completion instead of immediate 
assertion
   - No production code changes needed
   
   An automated fix proposal will be generated. Reply `/approve` to proceed 
with PR generation.
   
   ---
   *Automated evaluation by github-manager-bot*
   


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