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

Patrik Kleindl commented on KAFKA-7996:
---------------------------------------

>From a "user" perspective, if something is called a timeout then the 
>expectation is that whatever is called returns a response no later than the 
>given timeout. As the current behaviour does not conform to this it should be 
>corrected, not "improved".

I tried to look into the code and just want to verify my understanding (and 
maybe provide a simpler solution):

KafkaStreams.close(final long timeoutMs) starts a thread which tries to:
 # shutdown all StreamThreads, each one does sequentially
 ## Shutdown TaskManager
 ### Close Active Tasks
 #### Close StreamTask -> Close RecordCollector -> Close Producer with 
Long.MAX_VALUE
 ### Close Standby Tasks
 ### Close TaskCreator 
 #### Close ThreadProducer -> Default is Long.MAX_VALUE
 ## Close Consumer with DEFAULT_CLOSE_TIMEOUT_MS = 30 Seconds
 ## Close Restore Consumer with DEFAULT_CLOSE_TIMEOUT_MS = 30 Seconds
 ## Does  *not* close the producer of the StreamThread (this is done via the 
ThreadProducer in 1.1.3.1 it seems)
 # shutdown the GlobalStreamThread -> Tries to close the GlobalConsumer with 
DEFAULT_CLOSE_TIMEOUT_MS = 30 Seconds
 # Close the AdminClient -> Default is Long.MAX_VALUE

When I look at this a special configuration parameter for the producer timeout 
does really make sense because it doesn't really seem to provide any value 
because of all the other default values and the total time to close can be much 
longer anyway because of the sequential handling.

So basically any value >0 (eg. DEFAULT_CLOSE_TIMEOUT_MS) the for producer and 
admin client should prevent the blocking behaviour, and return after timeoutMs 
has passed, correct?

 

> KafkaStreams does not pass timeout when closing Producer
> --------------------------------------------------------
>
>                 Key: KAFKA-7996
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7996
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 2.1.0
>            Reporter: Patrik Kleindl
>            Assignee: Lee Dongjin
>            Priority: Major
>              Labels: needs-kip
>
> [https://confluentcommunity.slack.com/messages/C48AHTCUQ/convo/C48AHTCUQ-1550831721.026100/]
> We are running 2.1 and have a case where the shutdown of a streams 
> application takes several minutes
> I noticed that although we call streams.close with a timeout of 30 seconds 
> the log says
> [Producer 
> clientId=…-8be49feb-8a2e-4088-bdd7-3c197f6107bb-StreamThread-1-producer] 
> Closing the Kafka producer with timeoutMillis = 9223372036854775807 ms.
> Matthias J Sax [vor 3 Tagen]
> I just checked the code, and yes, we don't provide a timeout for the producer 
> on close()...



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

Reply via email to