Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce correct transfer settled flag #12371

Merged
merged 2 commits into from
Sep 25, 2024
Merged

Enforce correct transfer settled flag #12371

merged 2 commits into from
Sep 25, 2024

Conversation

ansd
Copy link
Member

@ansd ansd commented Sep 25, 2024

For messages published to RabbitMQ, RabbitMQ honors the transfer settled field, no matter what value the sender settle mode was set to in the attach frame.

Therefore, prior to this commit, a client could send a transfer with settled=true even though sender settle mode was set to unsettled in the attach frame.

This commit enforces that the publisher sets only transfer settled fields that are valid with the spec.

If sender settle mode is:

  • unsettled, the transfer settled flag must be false.
  • settled, the transfer settled flag must be true.
  • mixed, the transfer settled flag can be true or false.

This PR also fixes a bug in the AMQP 1.0 shovel:
The shovel violated the AMQP 1.0 spec by sending transfers with settled=true under sender settle mode unsettled if shovel ack-mode is set to on-publish.

This PR will break shovels if:

  1. shovel runs on RabbitMQ < 4.0.3, and
  2. connects via AMQP 1.0 to a RabbitMQ node >= 4.0.3, and
  3. uses shovel ack-mode value on-publish

Given all three combinations combined are extremely rare, on-publish alone is already a rare setting (on-confirm which is the default, or no-ack make much more sense than on-publish), I think it's fine to backport this PR to v4.0.x. In case someone hits this combination, the user can change the ack-mode.

For messages published to RabbitMQ, RabbitMQ honors the transfer `settled`
field, no matter what value the sender settle mode was set to in the attach
frame.

Therefore, prior to this commit, a client could send a transfer with
`settled=true` even though sender settle mode was set to `unsettled` in the
attach frame.

This commit enforces that the publisher sets only transfer `settled` fields
that are valid with the spec.

If sender settle mode is:
* `unsettled`, the transfer `settled` flag must be `false`.
* `settled`, the transfer `settled` flag must be `true`.
* `mixed`, the transfer `settled` flag can be `true` or `false`.
@ansd ansd added this to the 4.0.3 milestone Sep 25, 2024
The shovel violated the AMQP 1.0 spec by sending transfers with settled=true
under sender settle mode unsettled (in case of shovel ack-mode being
on-publish).
@ansd ansd marked this pull request as ready for review September 25, 2024 16:03
@ansd ansd merged commit c0fbc1a into main Sep 25, 2024
199 checks passed
@ansd ansd deleted the snd-settle-mode branch September 25, 2024 16:06
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.

2 participants