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

KafkaProducer.initTransactions dead locks

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 0.11.0.0, 0.11.0.1
    • Fix Version/s: None
    • Component/s: producer
    • Labels:
      None
    • Environment:
      Travis

      Description

      I have found some intermittent failures on travis when using Kafka 0.11 transactions for writing. One of them is a apparent deadlock with the following stack trace:

      "KafkaTestThread[19, false]" #166 prio=5 os_prio=0 tid=0x00007f4b64c29800 nid=0x1260 waiting on condition [0x00007f4b10fa4000]
         java.lang.Thread.State: WAITING (parking)
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x00000000947048a8> (a java.util.concurrent.CountDownLatch$Sync)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
      	at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
      	at org.apache.kafka.clients.producer.internals.TransactionalRequestResult.await(TransactionalRequestResult.java:50)
      	at org.apache.kafka.clients.producer.KafkaProducer.initTransactions(KafkaProducer.java:537)
      

      I was unsuccessful to reproduce it locally, however I think I can semi reliably reproduce it on Travis. Scenario includes simultaneous sequence of instantiating new producers, calling KafkaProducer.initTransactions, closing them interleaved with writing. I have created a stripped down version of this scenario as a github project:
      https://github.com/pnowojski/kafka-init-deadlock
      The code for the test scenario is here:
      https://github.com/pnowojski/kafka-init-deadlock/blob/master/src/test/java/pl/nowojski/KafkaInitDeadLockTest.java

      I have defined 30 build profiles that run this test and in case of detecting a dead lock (5 minutes period of inactivity), stack trace of all threads is being printed out. Example travis run:
      https://travis-ci.org/pnowojski/kafka-init-deadlock/builds/293256284
      as you can see deadlock occurred in 7 out of 30 builds. It seems like in this scenario all of them are failing/dead locking in exactly same way.

      I have observed this issue both on 0.11.0.0 and 0.11.0.1

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pnowojski Piotr Nowojski
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: