[
https://issues.apache.org/jira/browse/KAFKA-13412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Gustafson resolved KAFKA-13412.
-------------------------------------
Fix Version/s: 3.2.0
3.1.1
Resolution: Fixed
> 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
> Components: producer
> Reporter: Jason Gustafson
> Assignee: Jason Gustafson
> Priority: Major
> Fix For: 3.2.0, 3.1.1
>
>
> 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.20.1#820001)