You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Rajini Sivaram (JIRA)" <ji...@apache.org> on 2017/05/22 09:10:04 UTC

[jira] [Commented] (KAFKA-5187) producer.close() times out at 30 seconds

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

Rajini Sivaram commented on KAFKA-5187:
---------------------------------------

{{Producer#send}} is asynchronous. If you want to wait for send to complete, you can wait on the {{Future}} returned by {{send}}. That will also give you the error if send fails. {{Producer#close}} waits for pending sends to complete. Hence the timeout you are seeing is the send timing out.

> producer.close() times out at 30 seconds
> ----------------------------------------
>
>                 Key: KAFKA-5187
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5187
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 0.10.1.1
>            Reporter: Somnath Choudhuri
>
> In the code below, send() is successful and returns immediately. However producer.close() hangs and times out after 30 seconds.
> 		 producer.send(new ProducerRecord<String, String>(topic, "0", "test string 0")); 
> 		 System.out.println("Send successful");
> 		 
> 		 long start_time = System.currentTimeMillis();
> 		 producer.close();
> 		 long end_time = System.currentTimeMillis();
> 		 
> 		 System.out.println("Time spent in closing Producer: " + (end_time - start_time));



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)