Skip to content
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

Fix partial messages handling #1149

Merged
merged 4 commits into from
Aug 20, 2018
Merged

Fix partial messages handling #1149

merged 4 commits into from
Aug 20, 2018

Conversation

wladh
Copy link
Contributor

@wladh wladh commented Aug 10, 2018

Kafka 2.0 introduced chunked message down conversions which might
produce partial messages at the end of the set. These partial messages
are not well formed beyond offset and length, so they might cause
strange decoding errors down the line.
This fix makes lengthField a dynamicPushDecoder so it checks that
the packetDecoder has at least that many bytes. It fixes the problem
above and I think it's a more robust check in general.

Fixes #1144

Kafka 2.0 introduced chunked message down conversions which might
produce partial messages at the end of the set. These partial messages
are not well formed beyond offset and length, so they might cause
strange decoding errors down the line.
This fix makes `lengthField` a `dynamicPushDecoder` so it checks that
the `packetDecoder` has at least that many bytes. It fixes the problem
above and I think it's a more robust check in general.
@bai
Copy link
Contributor

bai commented Aug 13, 2018

Thanks for digging into this! I've pushed a test branch on CI but still seeing failures https://travis-ci.org/Shopify/sarama/jobs/415607362?

Also, this fixes the case when there's more than one message in a
message set with a partial trailing message.
@bai
Copy link
Contributor

bai commented Aug 16, 2018

Test branch is 🍏 , could please chery-pick 3de182b to enable Kafka 2.0 on CI?

@bai
Copy link
Contributor

bai commented Aug 20, 2018

Many thanks for contributing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when consuming: error decoding packet: CRC didn't match expected 0x0
3 participants