Question: I plan on storing stacktraces in the RabbitMQ message header. Do message headers have a size limit?

Answer: 
> 
> The answers so far seem to indicate that it would be no problem to cram a stacktrace in a header.
> 
> 
> 

As John insinuates in his answer previously, some changes were made a couple of years a go that will cause an `IllegalArgumentException` to be thrown when the header size exceeds `frame_max` (by default this is indeed 128kB).

[(The source code I'm referring to can be found here!)](https://github.com/rabbitmq/rabbitmq-java-client/blob/283902d3ed7e42098b60cbbf95154aa93a741dbd/src/main/java/com/rabbitmq/client/impl/AMQCommand.java#L113)

As a (fun) side note, this was done to prevent an issue whereby messages that had single huge header that exceeded max frame size would result in the client creating and transmitting the huge header frame to server and, as a result, the server shuts the connection down with `frame_too_large` error and that breaks all open channels!

In order to include a stacktrace in a header, you *could* increase the header size, or set it to `0` for 'unlimited', but you should be aware that this isn't particularly advisable in most situations (larger values may improve throughput while smaller values may improve latency).
Since you're using RabbitMQ I'm guessing that you're using the standard protocol, which is AMQP.
In that case you shouldn't add something like stacktraces in the header, since according to the [AMQP specification 3.2.1](http://docs.oasis-open.org/amqp/core/v1.0/amqp-core-messaging-v1.0.html#type-header) the header is used for `standard delivery details`:

> 
> The header section carries standard delivery details about the transfer of a message through the AMQP network. If the header section is omitted the receiver MUST assume the appropriate default values (or the meaning implied by no value being set) for the fields within the header unless other target or node specific defaults have otherwise been set.
> 
> 
> 

From what I found the specs doesn't mention anything about a specific size however, so it might be possible to cram a stacktrace in there if you want to :)