Aleksandr Savonin created FLINK-41797:
-----------------------------------------
Summary: KafkaSource can silently lose records when poll() throws
IllegalStateException with partitions assigned
Key: FLINK-41797
URL: https://issues.apache.org/jira/browse/FLINK-41797
Project: Flink
Issue Type: Bug
Components: Connectors / Kafka
Reporter: Aleksandr Savonin
KafkaPartitionSplitReader.fetch() catches every IllegalStateException from
KafkaConsumer.poll() and returns an empty batch.
It also hides poll failures while the consumer still has assigned partitions.
We reproduced the skip in memory with Kafka 4.2.0’s FetchCollector. During one
fetch, Kafka advanced partition A past offsets 100–104, then threw
IllegalStateException while processing a fetch error for partition B. The fetch
returned no records. When consumption continued with the same consumer state,
the next record delivered from A was at offset 105.
If Flink processes offset 105 and a subsequent checkpoint completes with 106 as
A’s next offset, restoring from that checkpoint skips records 100–104 even
while Kafka still retains them. The job can therefore keep running and
checkpointing without reporting that downstream missed five records.
Expected behavior: When partitions are assigned, the reader should propagate
the original IllegalStateException so Flink can apply the job’s restart
strategy. When an empty bounded split leaves the consumer with no assigned
partitions, the reader should continue to report that split as finished.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)