Output descriptive error if AMQP message has no body (backport #15048)#15049
Merged
michaelklishin merged 1 commit intov4.2.xfrom Dec 2, 2025
Merged
Output descriptive error if AMQP message has no body (backport #15048)#15049michaelklishin merged 1 commit intov4.2.xfrom
michaelklishin merged 1 commit intov4.2.xfrom
Conversation
According to the AMQP spec, a message must have a body.
amqpnetlite and Azure Service Bus support non-compliant AMQP where a
message might have no body. RabbitMQ implements the AMQP spec correctly
requiring a message body. This commit provides a nice error description
if a client wrongly sends a message without a body.
Prior to this commit, the session got terminated with the following
non-descriptive error:
```
[{mc_amqp,msg_body_encoded,
[[],0,
{msg_body_encoded,undefined,[],
{'v1_0.properties',undefined,undefined,undefined,undefined,
undefined,undefined,undefined,undefined,undefined,undefined,
undefined,undefined,undefined},
[],
<<0,83,115,69>>,
[],uninit,uninit}],
[{file,"mc_amqp.erl"},{line,612}]},
{mc_amqp,init,1,[{file,"mc_amqp.erl"},{line,145}]},
{mc,init,4,[{file,"mc.erl"},{line,157}]},
{rabbit_amqp_session,incoming_link_transfer,4,
[{file,"rabbit_amqp_session.erl"},{line,2409}]},
{rabbit_amqp_session,handle_frame,2,
[{file,"rabbit_amqp_session.erl"},{line,983}]},
{rabbit_amqp_session,handle_cast,2,
[{file,"rabbit_amqp_session.erl"},{line,558}]},
{gen_server,try_handle_cast,3,[{file,"gen_server.erl"},{line,2460}]},
{gen_server,handle_msg,3,[{file,"gen_server.erl"},{line,2418}]}]
```
(Note that transfer frames without payload are allowed though.)
(cherry picked from commit 8d7d291)
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.
According to the AMQP spec, a message must have a body.
amqpnetlite and Azure Service Bus support non-compliant AMQP where a message might have no body. RabbitMQ implements the AMQP spec correctly requiring a message body. This commit provides a nice error description if a client wrongly sends a message without a body.
Prior to this commit, the session got terminated with the following non-descriptive error:
(Note that transfer frames without payload are allowed though.)
This is an automatic backport of pull request #15048 done by Mergify.