Skip to content

Conversation

@ansd
Copy link
Member

@ansd ansd commented Dec 2, 2025

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.)

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.)
@ansd ansd marked this pull request as ready for review December 2, 2025 16:45
@kjnilsson kjnilsson self-requested a review December 2, 2025 16:48
@ansd ansd mentioned this pull request Dec 2, 2025
12 tasks
@ansd ansd merged commit 8d7d291 into main Dec 2, 2025
291 checks passed
@ansd ansd deleted the amqp-body branch December 2, 2025 17:16
michaelklishin added a commit that referenced this pull request Dec 2, 2025
Output descriptive error if AMQP message has no body (backport #15048)
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.

3 participants