Skip to content

Reject duplicate client-provided consumer tags in basic.consume - #2137

Merged
acogoluegnes merged 1 commit into
mainfrom
fix/reject-duplicate-consumer-tag
Oct 23, 2026
Merged

acogoluegnes merged 1 commit into
mainfrom
fix/reject-duplicate-consumer-tag

Conversation

@acogoluegnes

Copy link
Copy Markdown
Contributor

Calling basic.consume with a consumer tag already in use on the channel makes the broker close the channel. This can happen during connection recovery, when the application consumes with the same tag as a recorded consumer being recovered.

ChannelN now rejects a client-provided consumer tag that is already registered or reserved by an in-flight basic.consume, throwing an IllegalStateException before anything is sent to the broker. Tags are reserved ("leased") atomically before the request is sent and released when the call completes, so concurrent calls with the same tag cannot both reach the broker. A plain check is not enough because the RPC slot is released before the consume-ok reply registers the consumer.

Consumer recovery skips a recorded consumer whose tag is already registered on the new channel by the application.

Calling basic.consume with a consumer tag already in use on the
channel makes the broker close the channel. This can happen during
connection recovery, when the application consumes with the same tag
as a recorded consumer being recovered.

ChannelN now rejects a client-provided consumer tag that is already
registered or reserved by an in-flight basic.consume, throwing an
IllegalStateException before anything is sent to the broker. Tags are
reserved ("leased") atomically before the request is sent and released
when the call completes, so concurrent calls with the same tag cannot
both reach the broker. A plain check is not enough because the RPC
slot is released before the consume-ok reply registers the consumer.

Consumer recovery skips a recorded consumer whose tag is already
registered on the new channel by the application.
@acogoluegnes
acogoluegnes marked this pull request as ready for review October 23, 2026 08:45
@acogoluegnes
acogoluegnes merged commit 4364cab into main Oct 23, 2026
7 checks passed
@acogoluegnes
acogoluegnes deleted the fix/reject-duplicate-consumer-tag branch October 23, 2026 08:45
@acogoluegnes

Copy link
Copy Markdown
Contributor Author

@Mergifyio backport to v5.x

@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

backport to v5.x

❌ No backport have been created

Details
  • Backport to branch to failed

GitHub error: Branch not found

acogoluegnes added a commit that referenced this pull request Oct 23, 2026
Reject duplicate client-provided consumer tags in basic.consume (backport #2137)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant