PRECONDITION_FAILED - message size 16777217 is larger than configured max size 16777216
RabbitMQ refuses a message whose body is larger than max_message_size, 16 MiB (16777216 bytes) by default on RabbitMQ 4. It does so by closing the channel with reply code 406. Measured on RabbitMQ 4.3.6 with pika 1.4.4; 16777216 bytes went through, one byte more did not. The broker log:
[error] operation basic.publish caused a channel exception precondition_failed: message size 16777217 is larger than configured max size 16777216
| Publisher | Result |
|---|---|
| with publisher confirms | basic_publish raised ChannelClosedByBroker: (406, 'PRECONDITION_FAILED - message size …') |
| without confirms | basic_publish returned without error; the channel was closed a moment later |
| without confirms, next publish right after | also returned without error, and that message was lost as well |
| without confirms, next publish 0.2 s later | raised the error above |
Without confirms the publish call only writes to the socket, so the refusal arrives after the call has returned. Whatever the application publishes on that channel before it notices is gone too: in our test a small order-2 sent straight after the large one never reached the queue.
rabbitmq.conf and restart the node. With max_message_size = 33554432 the 16 MiB + 1 byte message was accepted. The ceiling is 512 MiB; with max_message_size = 600000000 the node did not start:[error] max_message_size invalid, Max message size should be between 0 and 512MB
[error] BOOT FAILED