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

Sometimes static KafkaConsumer.close will block the thread

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.8.2
    • None
    • clients, consumer
    • None
    • Java 8

    Description

      Sometimes, the thread will be blocked and never continue (state: waiting) after invoke KafkaConsumer.close(). Here are the related thread dump:

      Thread 73 (pool-5-thread-1):
        State: WAITING
        Blocked count: 25
        Waited count: 22
        Waiting on org.apache.kafka.clients.consumer.internals.AbstractCoordinator$HeartbeatThread@565a2927
        Stack:
          java.lang.Object.wait(Native Method)
          java.lang.Thread.join(Thread.java:1257)
          java.lang.Thread.join(Thread.java:1331)
          org.apache.kafka.clients.consumer.internals.AbstractCoordinator.closeHeartbeatThread(AbstractCoordinator.java:385)
          org.apache.kafka.clients.consumer.internals.AbstractCoordinator.close(AbstractCoordinator.java:1010)
          org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.close(ConsumerCoordinator.java:926)
          org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:2366)
          org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:2333)
          org.apache.kafka.clients.consumer.KafkaConsumer.close(KafkaConsumer.java:2283)
      Thread 687 (kafka-coordinator-heartbeat-thread | XXXX-st-c35):
        State: WAITING
        Blocked count: 0
        Waited count: 1
        Waiting on org.apache.kafka.clients.consumer.internals.ConsumerCoordinator@51f1e632
        Stack:
          java.lang.Object.wait(Native Method)
          java.lang.Object.wait(Object.java:502)
          org.apache.kafka.clients.consumer.internals.AbstractCoordinator$HeartbeatThread.run(AbstractCoordinator.java:1360)
      

      Attachments

        1. screenshot-5.png
          98 kB
          Kuradeon
        2. screenshot-4.png
          134 kB
          Kuradeon
        3. screenshot-3.png
          54 kB
          Kuradeon
        4. screenshot-2.png
          95 kB
          Kuradeon
        5. screenshot-1.png
          507 kB
          Kuradeon
        6. image-2024-08-07-18-06-05-222.png
          98 kB
          Kuradeon
        7. image-2024-08-07-18-03-46-042.png
          90 kB
          Kuradeon
        8. image-2024-08-07-16-50-15-701.png
          92 kB
          Kuradeon

        Activity

          People

            Unassigned Unassigned
            kuradeon Kuradeon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: