Skip to content

fix: stuck on the batch with zero records length#2057

Merged
bai merged 1 commit intoIBM:mainfrom
pachmu:fix-empty-batch-consume
Nov 8, 2021
Merged

fix: stuck on the batch with zero records length#2057
bai merged 1 commit intoIBM:mainfrom
pachmu:fix-empty-batch-consume

Conversation

@pachmu
Copy link

@pachmu pachmu commented Nov 2, 2021

#2053
Sometimes in rare cases of corruption or other reason, Kafka can return batches with zero records even if a high watermark was not reached. In this case, sarama just tries to reread this batch again and again and is stuck. There is no resolution in this case except skipping this batch.
librdkafka can handle these cases skipping with a warning.

@pachmu pachmu requested a review from bai as a code owner November 2, 2021 14:49
@ghost ghost added the cla-needed label Nov 2, 2021
@pachmu pachmu force-pushed the fix-empty-batch-consume branch from 583da58 to a8a9228 Compare November 2, 2021 15:01
Copy link
Collaborator

@dnwe dnwe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks like a great catch

@bai bai merged commit 99c86c9 into IBM:main Nov 8, 2021
@pachmu pachmu deleted the fix-empty-batch-consume branch November 8, 2021 09:08
@dnwe dnwe added the fix label Dec 4, 2021
dnwe added a commit that referenced this pull request Jul 31, 2025
This pull request addresses the known issue described in
[KAFKA-5443](https://issues.apache.org/jira/browse/KAFKA-5443), which
was initially analyzed in
[#2053](#2053). A prior attempt to fix
it was made in [#2057](#2057), but the
fix was applied incorrectly and did not fully resolve the root cause.

I’ve provided a more detailed explanation of the underlying issue and
the reasoning behind this fix in [this
comment](#3150 (comment)).

---------

Signed-off-by: Sterligov Denis <[email protected]>
Signed-off-by: Dominic Evans <[email protected]>
Co-authored-by: Sterligov Denis <[email protected]>
Co-authored-by: Dominic Evans <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants