Jason Gustafson created KAFKA-13412:
---------------------------------------

             Summary: Retry of initTransactions after timeout may cause invalid 
transition
                 Key: KAFKA-13412
                 URL: https://issues.apache.org/jira/browse/KAFKA-13412
             Project: Kafka
          Issue Type: Bug
            Reporter: Jason Gustafson
            Assignee: Jason Gustafson


If `initTransactions()` cannot be completed before the timeout defined by 
`max.block.ms`, then the call will raise a `TimeoutException`. The user is 
expected to retry this, which is what Kafka Streams does. However, the producer 
will keep retrying the `InitProducerId` request in the background and it is 
possible for it to return before the retry call to `initTransaction()`. This 
leads to the following exception:
{code}
org.apache.kafka.common.KafkaException: TransactionalId blah: Invalid 
transition attempted from state READY to state INITIALIZING

        at 
org.apache.kafka.clients.producer.internals.TransactionManager.transitionTo(TransactionManager.java:1077)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.transitionTo(TransactionManager.java:1070)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.lambda$initializeTransactions$1(TransactionManager.java:336)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.handleCachedTransactionRequestResult(TransactionManager.java:1198)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.initializeTransactions(TransactionManager.java:333)
        at 
org.apache.kafka.clients.producer.internals.TransactionManager.initializeTransactions(TransactionManager.java:328)
        at 
org.apache.kafka.clients.producer.KafkaProducer.initTransactions(KafkaProducer.java:597)
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to