Skip to content

Conversation

@berg223
Copy link
Contributor

@berg223 berg223 commented Feb 8, 2026

Fixes #25220

Motivation

There is an issue that chunked message cannot be redeliveryed for shared subscription mode. The client should send all chunk message ids to broker for redelivery but it hasn't. It only send the last chunk messageId and that's the root cause of this issue.

The problematic code path​​ is that:

    NegativeAcksTracker#triggerRedelivery
        UnAckedMessageTracker#addChunkedMessageIdsAndRemoveFromSequenceMap

In addChunkedMessageIdsAndRemoveFromSequenceMap method, all chunk messageIds of same message should be fetched from consumerBase.unAckedChunkedMessageIdSequenceMap but it found nothing there. Actually, unAckedChunkedMessageIdSequenceMap has recorded the value by key which has type of ChunkMessageIdImpl. ChunkMessageIdImpl has a different hashcode from MessageIdImpl. That's why we found nothing there.

I have noticed that there is a nackedMessageIds map in NegativeAcksTracker. And it's convenient to record the origin messageId by nackedMessageIds which has a type of ChunkMessageIdImpl.

Modifications

Record the origin messageId by the map nackedMessageIds in NegativeAcksTracker#add

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

MessageChunkingSharedTest#testNegativeAckChunkedMessage

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: berg223#4

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

@berg223 Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Feb 8, 2026
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing the issue @berg223

@lhotari lhotari changed the title [fix][client] All chunkMessageIds sent to broker for redelivery [fix][client] Send all chunkMessageIds to broker for redelivery Feb 9, 2026
@lhotari lhotari merged commit f42cd25 into apache:master Feb 9, 2026
159 of 169 checks passed
@lhotari
Copy link
Member

lhotari commented Feb 9, 2026

Kudos to @davidsealand-toast for investigating and reporting the issue and providing the test case that reproduces the issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [java client] Nacked chunked messages do not get redelivered

2 participants