[ 
https://issues.apache.org/jira/browse/KAFKA-6812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524080#comment-16524080
 ] 

Andras Beni commented on KAFKA-6812:
------------------------------------

[~enether] 
In sync mode, when an exception occurs, it is logged, and the tool immediately 
exits with error status. In async mode, the same situation is  handled by 
logging, continuing operation and exit code will still be 0. I also see how 
this behavior can be derived from current implementation. I was questioning if 
it is correct and by design, because loosing data should be unexpected and the 
difference in error handling is not obvious from sync-async distinction. If 
this difference is intended, I propose to either
* document that in async mode dropping records is expected and accepted or
* add a flag (e.g. --error-handler-strategy) so users can choose how they want 
to handle errors.

If the latter case is acceptable for you, I am happy to write the KIP and 
implement. 
If neither option is acceptable, feel free to close this issue.

> Async ConsoleProducer exits with 0 status even after data loss
> --------------------------------------------------------------
>
>                 Key: KAFKA-6812
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6812
>             Project: Kafka
>          Issue Type: Bug
>          Components: tools
>    Affects Versions: 1.1.0
>            Reporter: Andras Beni
>            Assignee: Stanislav Kozlovski
>            Priority: Minor
>
> When {{ConsoleProducer}} is run without {{--sync}} flag and one of the 
> batches times out, {{ErrorLoggingCallback}} logs the error:
> {code:java}
>  18/04/21 04:23:01 WARN clients.NetworkClient: [Producer 
> clientId=console-producer] Connection to node 10 could not be established. 
> Broker may not be available.
>  18/04/21 04:23:02 ERROR internals.ErrorLoggingCallback: Error when sending 
> message to topic my-topic with key: null, value: 8 bytes with error:
>  org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for 
> my-topic-0: 1530 ms has passed since batch creation plus linger time{code}
>  However, the tool exits with status code 0. 
>  In my opinion the tool should indicate in the exit status that there was 
> data lost. Maybe it's reasonable to exit after the first error.
>   



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to