Skip to content

Header size exception when frame max is negotiated to 0 #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lau-sch opened this issue Sep 19, 2018 · 8 comments · Fixed by #408
Closed

Header size exception when frame max is negotiated to 0 #407

lau-sch opened this issue Sep 19, 2018 · 8 comments · Fixed by #408
Assignees
Milestone

Comments

@lau-sch
Copy link

lau-sch commented Sep 19, 2018

We started facing errors when trying to publish messages after our upgrade to latest client library:

java.lang.IllegalArgumentException: Content headers exceeded max frame size: 47 > 0
	at com.rabbitmq.client.impl.AMQCommand.transmit(AMQCommand.java:115)
	at com.rabbitmq.client.impl.AMQChannel.quiescingTransmit(AMQChannel.java:447)
	at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:423)
	at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:704)
	at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:679)
	at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:669)
	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicPublish(AutorecoveringChannel.java:192)
	at com.company.RabbitAppender.append(...)
	at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:82)
	at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
	at net.logstash.logback.appender.DelegatingAsyncDisruptorAppender$DelegatingEventHandler.onEvent(DelegatingAsyncDisruptorAppender.java:54)
	at net.logstash.logback.appender.DelegatingAsyncDisruptorAppender$DelegatingEventHandler.onEvent(DelegatingAsyncDisruptorAppender.java:50)
	at net.logstash.logback.appender.AsyncDisruptorAppender$EventClearingEventHandler.onEvent(AsyncDisruptorAppender.java:330)
	at net.logstash.logback.appender.AsyncDisruptorAppender$EventClearingEventHandler.onEvent(AsyncDisruptorAppender.java:318)
	at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168)
	at net.logstash.logback.encoder.com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

This is used to send Logstash/SLF4J log statements to Rabbit, we have control over the ConnectionFactory and we don't set frame max, leaving it as 0 (no limit). These errors appeared when upgrading the client lib from 5.0.0 to 5.4.1.

Apparently it was caused by the fix of this issue, since on this line it checks the frameMax for zero, but 3 lines below it still uses original frameMax to check large headers, causing the exception above.

RabbitMQ 3.7.4
Erlang 20.2.3
Java 1.8.0_181
RabbitMQ client 5.4.1

@michaelklishin
Copy link
Contributor

Since you understand the root cause, why not submit a PR?

I don't know if frame_max of 0 is something we recommend but I'll assume you mean you don't have control over ConnectionFactory settings.

@michaelklishin michaelklishin self-assigned this Sep 19, 2018
@michaelklishin michaelklishin added this to the 4.8.2 milestone Sep 19, 2018
@michaelklishin
Copy link
Contributor

No worries, I will take a look since there's enough information available to put together a test case.

@lau-sch
Copy link
Author

lau-sch commented Sep 19, 2018

@michaelklishin Sorry, I followed the site instructions to run the client tests but I couldn't make the brokers run. I'd submit a PR if I could add and run at least one test for it, and since I couldn't I opted for just reporting it.

@michaelklishin
Copy link
Contributor

For this issue to be reproduced both server and client must be configured to use frame_max value of 0 (which is pretty rare with modern versions).

@michaelklishin michaelklishin changed the title Header size exception when frame max is 0 Header size exception when frame max is negotiated to 0 Sep 19, 2018
michaelklishin added a commit that referenced this issue Sep 19, 2018
@michaelklishin
Copy link
Contributor

@lau-sch any chance you can build the client from master and give it a try? It can be done with make deps && make dist, the latter is basically ./mvnw install that skips running tests.

@michaelklishin
Copy link
Contributor

Oh, and the build system depends on a code generator that will require Python and Erlang 20.3+.

@lau-sch
Copy link
Author

lau-sch commented Sep 20, 2018

@michaelklishin Built from latest master, worked great. I haven't seen frame_max configuration suggestions before, but given you comment and the purpose of the parameter I'll be setting it to something adequate given our scenario. Thanks Michael!

@michaelklishin
Copy link
Contributor

@lau-sch thank you, I'll proceed with producing a release soon. Default frame_max in RabbitMQ these days is 131072.

acogoluegnes pushed a commit that referenced this issue Sep 25, 2018
…limited

Closes #407, references #362.
[#160628331]

(cherry picked from commit 73e3530)
acogoluegnes pushed a commit that referenced this issue Sep 25, 2018
…limited

Closes #407, references #362.
[#160628331]

(cherry picked from commit 73e3530)
acogoluegnes pushed a commit that referenced this issue Sep 25, 2018
…limited

Closes #407, references #362.
[#160628331]

(cherry picked from commit 73e3530)
acogoluegnes pushed a commit that referenced this issue Sep 25, 2018
…limited

Closes #407, references #362.
[#160628331]

(cherry picked from commit 73e3530)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants