Skip to content

Reject duplicate client-provided consumer tags in basic.consume (backport #2137) - #2138

Merged
acogoluegnes merged 1 commit into
v5.xfrom
mergify/bp/v5.x/pr-2137
Oct 23, 2026
Merged

acogoluegnes merged 1 commit into
v5.xfrom
mergify/bp/v5.x/pr-2137

Conversation

@mergify

@mergify mergify Bot commented Oct 23, 2026

Copy link
Copy Markdown

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.


This is an automatic backport of pull request #2137 done by Mergify.

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.

(cherry picked from commit eff8a62)
@acogoluegnes acogoluegnes added this to the 5.38.0 milestone Oct 23, 2026
@acogoluegnes
acogoluegnes merged commit d80d749 into v5.x Oct 23, 2026
4 checks passed
@acogoluegnes
acogoluegnes deleted the mergify/bp/v5.x/pr-2137 branch October 23, 2026 09:34
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