Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13412

Retry of initTransactions after timeout may cause invalid transition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0, 3.1.1
    • producer
    • None

    Description

      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:

      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)
      

      Attachments

        Issue Links

          Activity

            People

              hachikuji Jason Gustafson
              hachikuji Jason Gustafson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: