添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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
Versions

Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.
Sarama Version: d65b3fd ( latest )
Kafka Version: N/A
Go Version: N/A

Configuration
Problem Description

ErrInvalidMessage (Kafka error 2) returns "kafka server: Message contents does not match its CRC." as its error message. However, sending a message without a key to a log-compacted topic also results in error 2. As you can imagine, this was quite confusing.

Suggested replacement: "kafka server: Message is invalid."

The original message was taken from the wiki page which has now become https://kafka.apache.org/protocol#protocol_error_codes . That page now says the following about error 2:

This message has failed its CRC checksum, exceeds the valid size, or is otherwise corrupt.

I suppose a missing key still technically falls into the category of "otherwise corrupt", but the wording makes it sound like an internal error, not something the user has obvious control over. @edenhill should the broker really be returning error 2 in this case, or does the description of the error message need to be updated?

Encountered this issue also.

The problem was the payload size that was bigger than the kafka max size flag: message.max.bytes: 1000012 (around 1MB)
Ended up increasing the kafka flag and all works well.

Cheers

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 master 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.