ErrMessageSizeTooLarge indicates a kafka server response when the error is in the Producer
Versions
| Sarama | Kafka | Go |
|---|---|---|
| 1.29.0 | any | 1.17 |
Configuration
What configuration values are you using for Sarama and Kafka?
defaults
Logs
Logs aren’t especially important here (not a bug), except to say that the relevant error is kafka server: Message was too large, server rejected it to avoid allocation error.
Problem Description
When the message size exceeds Producer.MaxMessageBytes, the error message indicates that the error is coming from the Kafka server, when in fact it’s a Producer error.
In our application, we recently spent a fair amount of time working with a customer, chasing down this issue -- we unproductively focused on the server while the error was in our software. https://github.com/cockroachdb/cockroach/issues/76258. The downstream server had a very large max message size (hundreds of MB), but the errors persisted, and it took a while to recognize that Producer.MaxMessageBytes (defaulted to 1MB) was the culprit.
We’d like to see a more accurate and descriptive error message.
Thanks for the consideration, I can mock up a PR to illustrate a preferred solution if it would be helpful.
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
Fixed by https://github.com/IBM/sarama/pull/2628