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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10256 
   
   ### Brief Description
   
   When `enablePopBatchAck `and `appendAckAsync `are both enabled, 
`PopBufferMergeService.scan()` passes a class-level shared `batchAckIndexList 
`to the async `putBatchAckToStore()`, then immediately clears the list in the 
`finally `block. The async callback captures the same (now-empty) list 
reference, causing `toStoreBits `to never be updated. This prevents checkpoint 
wrappers from being removed from the unbounded `commitOffsets `queue, leading 
to memory leak and potential OOM.
   
   ### Changes
   
   Pass a defensive copy `new ArrayList<>(indexList)` to `putBatchAckToStore()` 
so the async callback captures an independent snapshot
   Added unit test `testBatchAckAsyncShouldUpdateToStoreBitsAfterFix `to verify 
`toStoreBits `is correctly updated after async callback completes
   


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