Closed floyd-may closed 5 years ago
Is MassTransit adding any headers to the messages?
It most certainly is. Am I mistaken to believe that shouldn't be a protocol violation?
(misspelled from my mobile phone)
On Thu, Oct 4, 2018, 1:28 PM Michael Bridgen notifications@github.com wrote:
Is MassTransit adding any headers to the messages?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/squaremo/amqp.node/issues/462#issuecomment-427122799, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiMNMxMytXb9Yg20go22kqHidsy47U-ks5uhlNcgaJpZM4XGWBK .
It most certainly is. Am I mistaken to believe that shouldn't be a protocol violation?
Adding headers is OK yeah. The spec says nothing about what to do if the message header frame is too big to encode into the maximum frame size -- there's no way to have a continuation (header) frame, for example.
The default maximum frame size in amqplib is 4k bytes. That's pretty generous, but it's certainly possible that a careless intermediary could add ~4k of headers. Bumping the max size up with the connection argument frameMax
might fix it. But there's the possibility that the added headers are unbounded (as they were in #135).
Here's some code from the client library that MassTransit uses:
If I'm reading this correctly, the FIXME
comment here on line 237 is where amqp.node is throwing. Based on the spec, I think amqp.node is "righter" to throw here:
Agreed limits MAY enable both parties to pre-allocate key buffers, avoiding deadlocks. Every incoming frame either obeys the agreed limits, and so is "safe", or exceeds them, in which case the other party IS faulty and MUST be disconnected. This is very much in keeping with the “it either works properly or it doesn't work at all” philosophy of AMQP.
It seems like the C# client is being more "tolerant" but feels guilty about it.
However, what I don't have (and probably am out of my depth in getting) is the details of the negotiation. What would you recommend?
However, what I don't have (and probably am out of my depth in getting) is the details of the negotiation. What would you recommend?
There's a negotiation in the connection opening epic, governed by the Tune
and TuneOK
; the server sends its preferred value in Tune
, and it can be lowered or accepted by the client in TuneOK
.
RabbitMQ sends either 0 (meaning unlimited) or a large value, I can't remember which; amqplib, by default, lowers it to 4k, a number I decided on unscientifically as being better for multiplexing fairness. You can set the value you want with the connection parameter frameMax
, either in the querystring of the URL or field of the object, including to 0
meaning "accept whatever the server says".
@floyd-may ok to close?
Sure? ¯\(ツ)/¯ Seems like amqplib is doing The Right Thing ™ here.
Do you guys have a suggestion of how can I discard the message with the large headers and keep consumer going? (Or recreating consumer)
Appears to be related to https://github.com/squaremo/amqp.node/issues/135. Stack trace appears to be pretty similar as well. Creating a new issue because the
x-death
header issue is not in play here as it appeared to be in the other issue. I'm attempting to read messages from an error queue that MassTransit creates when processing a message throws an exception.