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

Yu LIU edited comment on KAFKA-6446 at 1/29/18 9:59 AM:
--------------------------------------------------------

Hello,
I have a look at this and it appears that TRANSACTION_TIMEOUT_CONFIG is defined 
as the time to wait when *a producer tries to get the producer id from 
transaction coordinator by specifying transaction id*, more concretely it's for 
[InitProducerIdRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/InitProducerIdRequest.java].
But where we hang here is before InitProducerIdRequest, we need to find the 
transaction coordinator by sending a 
[FindCoordinatorRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/FindCoordinatorRequest.java],
 in this phase we didn't deal with timeout so it leads to the [Sender thread 
endless retrying to send 
FindCoordinatorRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java#L161-L167].


I think anyway the producer shoud not be stuck in initTransactions() when it 
can't connect to the kafka cluster ? We should define a new TIMEOUT for 
connecting to the cluster (FindCoordinatorRequest) or applying the 
TRANSACTION_TIMEOUT_CONFIG to it directly ?


was (Author: pnpie):
Hello,
I have a look at this and it appears that TRANSACTION_TIMEOUT_CONFIG is defined 
as the time to wait when *a producer tries to get the producer id from 
transaction coordinator by specifying transaction id*, more concretely it's for 
[InitProducerIdRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/InitProducerIdRequest.java].
But where we hang here is before InitProducerIdRequest, we need to find the 
transaction coordinator by sending a 
[FindCoordinatorRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/FindCoordinatorRequest.java],
 for this phase we didn't treat timeout case so it leads to the [Sender thread 
endless retrying to send 
FindCoordinatorRequest|https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java#L161-L167].


So I think anyway the producer shoud not be stuck in initTransactions() when it 
can't connect to the kafka cluster ? We should to define a new TIMEOUT for 
connecting to the cluster (FindCoordinatorRequest) or applying the 
TRANSACTION_TIMEOUT_CONFIG to it directly ?

> KafkaProducer with transactionId endless waits when bootstrap server is down
> ----------------------------------------------------------------------------
>
>                 Key: KAFKA-6446
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6446
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, producer 
>    Affects Versions: 0.11.0.0, 1.0.0
>            Reporter: Eduardo Sciullo
>            Priority: Critical
>         Attachments: Test.java
>
>
> When bootstrap server is down, a KafkaProducer with transactionId endless 
> waits on initTransactions. 
> The timeouts don't apply to that operation: don't honor the 
> {{TRANSACTION_TIMEOUT_CONFIG.}}
> Attached an example of my code to reproduce the scenario.
>  
> I opened this issue as suggested by [Gary 
> Russell|https://stackoverflow.com/users/1240763/gary-russell]
> [https://stackoverflow.com/questions/48226546/defaultkafkaproducerfactory-with-transactionidprefix-endless-waits-when-bootstra]
>  



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

Reply via email to