Repository navigation
mc_amqpl: remove parsing of <= 3.13 AMQP 1.0 compatibility headers - #17272
Merged
Merged
Conversation
`basic.properties.type` is a free-form AMQP 0.9.1 property. `convert_to/3` took a value of `amqp-1.0` to mean the payload holds AMQP 1.0 encoded body sections and decoded it on that basis, without checking that the payload is well formed, or that the sections it decodes to belong in a message body. Check both, and fall back to a single data section otherwise. A publisher that means something else by `amqp-1.0` now gets the same conversion as any other AMQP 0.9.1 publisher. The type itself is still needed, because `convert_from/3` sets it whenever an AMQP 1.0 message with an amqp-value or amqp-sequence body, or with a footer, is converted to AMQP 0.9.1.
RabbitMQ 3.13 and earlier stored a message received over AMQP 1.0 as an
AMQP 0.9.1 `#content{}`, keeping the sections that do not map to AMQP 0.9.1
in four headers:
x-amqp-1.0-properties
x-amqp-1.0-app-properties
x-amqp-1.0-message-annotations
x-amqp-1.0-footer
The module that wrote them was replaced in 4.0, so the only messages that
carry them are ones a 3.13 or earlier node stored and no consumer has read
since. `mc_amqpl` still looked all four up on every conversion to AMQP 1.0.
Three message annotations have the same history in the other direction:
x-basic-delivery-mode
x-basic-priority
x-basic-expiration
`rabbit_msg_record` wrote these when it encoded an AMQP 0.9.1 message as
AMQP 1.0 for a stream. It was deleted before 4.0, so only a stream written
by a 3.13 or earlier node contains them.
Drop all seven. The headers now convert like any other x- header, which is
what an AMQP 0.9.1 consumer of such a message has always seen, and a
recovered stream entry no longer restores a delivery mode, priority or
expiration that the 4.x annotations do not carry.
`x-basic-type` stays: `convert_to/3` writes it because
`basic.properties.type` has no AMQP 1.0 equivalent.
`mc_amqpl:essential_properties/1` matched `{ok, TTL}` on
`rabbit_basic:parse_expiration/1`, which returns an error for a value that
is not a non-negative integer. It runs for every message `mc_amqpl:init/1`
initialises.
`rabbit_channel` calls `check_expiration_header/1` before building the
message, so for an AMQP 0.9.1 publisher the match always succeeds.
Producers that build a `#content{}` themselves do not go through that check.
Ignore an expiration that does not parse. This changes nothing for AMQP
0.9.1, where the channel still rejects it before the message is built.
|
Tick the box to add this pull request to the merge queue (same as
|
michaelklishin
requested changes
Aug 31, 2026
Collaborator
There was a problem hiding this comment.
Should we apply the same idea as in 7111f4d to mc_amqpl:convert_to/3 (lines 341-347)?
Something like this
MsgTTL = case rabbit_basic:parse_expiration(Props) of
{ok, Ttl} -> Ttl;
{error, _} -> undefined
end,
michaelklishin
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows through on the decision in #16077 (comment) to remove parsing of the AMQP 1.0
compatibility headers in 4.4 rather than harden their validation.
RabbitMQ 3.13 and earlier stored a message received over AMQP 1.0 as an
AMQP 0-9-1
#content{}, keeping the sections that do not map to AMQP 0-9-1 infour headers:
The module that wrote them was replaced in 4.0, so the only messages that carry
them are ones a 3.13 or earlier node stored and no consumer has read since.
mc_amqplstill looked all four up on every conversion to AMQP 1.0. Such amessage is still delivered, with these headers now converted like any other
x-header, which is what an AMQP 0-9-1 consumer of one has always seen.Three message annotations have the same history in the other direction:
x-basic-delivery-mode,x-basic-priorityandx-basic-expiration.rabbit_msg_recordwrote them when it encoded an AMQP 0-9-1 message as AMQP 1.0for a stream, and it was deleted before 4.0, so only a stream entry written by a
3.13 or earlier node carries them.
x-basic-typestays, becausebasic.properties.typehas no AMQP 1.0 equivalent.Two smaller changes to the same conversion code:
basic.properties.typeis a free-form AMQP 0-9-1 property, butconvert_to/3took a value of
amqp-1.0to mean the payload holds AMQP 1.0 encoded bodysections. It now checks that the payload is well formed and that the sections
it decodes to belong in a message body, and falls back to a single data
section otherwise.
essential_properties/1matched{ok, TTL}onrabbit_basic:parse_expiration/1.rabbit_channelchecksexpirationbeforebuilding the message, but producers that build a
#content{}themselves donot go through that check, so an expiration that does not parse is now
ignored. This changes nothing for AMQP 0-9-1.