Skip to content

[fix][client] Fix race condition between isDuplicate() and flushAsync() method in PersistentAcknowledgmentsGroupingTracker due to incorrect use Netty Recycler#26

Closed
oneby-wang wants to merge 3 commits intomasterfrom
batch_msg_individual_ack_race_condition_fix
Closed

[fix][client] Fix race condition between isDuplicate() and flushAsync() method in PersistentAcknowledgmentsGroupingTracker due to incorrect use Netty Recycler#26
oneby-wang wants to merge 3 commits intomasterfrom
batch_msg_individual_ack_race_condition_fix

Conversation

@oneby-wang
Copy link
Owner

@oneby-wang oneby-wang commented Feb 3, 2026

Fixes apache#25145

Motivation

See apache#25145 (comment).

Due to the use of Netty Recycler, a ConcurrentBitSetRecyclable instance may still be used after being recycled. However, recycling clears all bits, which causes the isDuplicate() method to always return true.

Modifications

Replace ConcurrentBitSetRecyclable with ConcurrentBitSet, ensure that ackSet is only cleared when the ackXxx method is invoked.

As apache#24766 suggested, we should stop using Netty Recycler in new code. Since using Netty Recycler is kind of error prone way here, I think we should remove it.

Verifying this change

  • Make sure that the change passes the CI checks.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@oneby-wang oneby-wang changed the title [fix][client] Fix race condition between get() and recycle() method in ConcurrentBitSetRecyclable due to incorrect use Netty recycler [fix][client] Fix race condition between get() and recycle() method in ConcurrentBitSetRecyclable due to incorrect use Netty Recycler Feb 3, 2026
@oneby-wang oneby-wang force-pushed the batch_msg_individual_ack_race_condition_fix branch from a852ef4 to 44af940 Compare February 3, 2026 08:57
@oneby-wang oneby-wang changed the title [fix][client] Fix race condition between get() and recycle() method in ConcurrentBitSetRecyclable due to incorrect use Netty Recycler [fix][client] Fix race condition between isDuplicate() and flushAsync() method in PersistentAcknowledgmentsGroupingTracker due to incorrect use Netty Recycler Feb 4, 2026
@oneby-wang oneby-wang closed this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Java consumer occasionally missing one message of a batched entry

1 participant