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

FencedInstanceIdException can cause heartbeat thread to never be closed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5.1, 2.7.0
    • None
    • clients
    • None

    Description

      The bug has been there since static consumers was introduced.

      The problem is all within AbstractCoordinator.java

      If a FencedInstanceIdException is throw and onFailure (line 1406) is called by a thread other than the heartbeat thread this will occur.  

      In the onFailure callback the heartbeatThread.failed is set and the heartbeatThread is disabled, but the actual thread is waiting on line 1350 (AbstractCoordinator.this.wait())

      Sometime later pollHeartbeat is called (line 316).  The check for hasFailed is true so it sets heartbeatThread = null without freeing the thread and now it will never be closed.

       

      I have verified this within a debuger using two clients that create read and close over and over again using the same group and instance id.  I tested this with 2.5.1 but found the same code bug to be in the latest master branch, the above line numbers are for the latest in github.

      Attachments

        Activity

          People

            Unassigned Unassigned
            brianhks Brian Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: