Skip to content

[ISSUE #10256] Fix shared mutable batchAckIndexList causing toStoreBits update failure in PopBufferMergeService#10257

Open
LiyunZhang10 wants to merge 3 commits into
apache:developfrom
LiyunZhang10:fix-shared-batchAckIndexList-in-PopBufferMergeService
Open

[ISSUE #10256] Fix shared mutable batchAckIndexList causing toStoreBits update failure in PopBufferMergeService#10257
LiyunZhang10 wants to merge 3 commits into
apache:developfrom
LiyunZhang10:fix-shared-batchAckIndexList-in-PopBufferMergeService

Conversation

@LiyunZhang10
Copy link
Copy Markdown

Which Issue(s) This PR Fixes

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

…toreBits update failure in PopBufferMergeService

When enablePopBatchAck and appendAckAsync are both enabled, 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.

Fix: pass a defensive copy new ArrayList<>(indexList) so the async callback
captures an independent snapshot of the index data.

Made-with: Cursor
@LiyunZhang10 LiyunZhang10 force-pushed the fix-shared-batchAckIndexList-in-PopBufferMergeService branch from 7bee793 to c2884e5 Compare April 13, 2026 09:18
Copy link
Copy Markdown
Contributor

@qianye1001 qianye1001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

RongtongJin
RongtongJin previously approved these changes May 30, 2026
@RongtongJin
Copy link
Copy Markdown
Contributor

Could you please merge the latest develop branch into this PR and let CI run again? The fix is focused and already has a relevant regression test; once it is up to date and CI is green, this should be ready to merge.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.95%. Comparing base (a705dbc) to head (4bf07d9).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10257      +/-   ##
=============================================
- Coverage      48.03%   47.95%   -0.08%     
+ Complexity     13284    13252      -32     
=============================================
  Files           1376     1376              
  Lines         100536   100536              
  Branches       12983    12983              
=============================================
- Hits           48292    48214      -78     
- Misses         46326    46356      +30     
- Partials        5918     5966      +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LiyunZhang10 LiyunZhang10 requested a review from RongtongJin June 1, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants