Alan Lau created KAFKA-21740:
--------------------------------

             Summary: TimeoutException from partitionsFor() at a sink with a 
partitioner goes to the ProcessingExceptionHandler instead of being retried 
under task.timeout.ms
                 Key: KAFKA-21740
                 URL: https://issues.apache.org/jira/browse/KAFKA-21740
             Project: Kafka
          Issue Type: Bug
          Components: streams
    Affects Versions: 4.5.0
            Reporter: Alan Lau
            Assignee: Alan Lau


Before each send, a sink with a {{StreamPartitioner}} calls 
{{{}producer.partitionsFor(){}}}. If the producer has no metadata for the topic 
(for example, the topic does not exist yet) and cannot fetch it within 
{{max.block.ms, partitionsFor()}} throws a {{{}TimeoutException{}}}, which 
{{RecordCollectorImpl}} rethrows to trigger {{{}task.timeout.ms{}}}. When a 
processor sits before the sink, {{ProcessorNode.process()}} catches the 
exception first and passes it to the {{{}ProcessingExceptionHandler{}}}, 
because {{TimeoutException}} is not in its rethrow list.

* With the default {{{}LogAndFailProcessingExceptionHandler{}}}, the stream 
thread dies.
* With a handler that continues, such as 
{{LogAndContinueProcessingExceptionHandler,}} the record is dropped and its 
input offset committed, so it is lost under both at_least_once and 
exactly_once_v2.

A sink directly after a source is not affected: the timeout reaches StreamTask 
and is retried.

Affected sinks, including ones without a user partitioner: any sink given a 
partitioner ({{{}Produced, Repartitioned, Topology#addSink, TableJoined{}}}), 
windowed-key sinks ({{{}WindowedStreamPartitioner{}}}), and the foreign-key 
join response sink ({{{}DefaultForeignResponseSinkPartitioner{}}}).

Streams should retry the task, as it does for other client timeouts, until 
{{task.timeout.ms }}passes, instead of passing the exception to the 
{{{}ProcessingExceptionHandler{}}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to