Brian Hawkins created KAFKA-12585: ------------------------------------- Summary: FencedInstanceIdException can cause heartbeat thread to never be closed Key: KAFKA-12585 URL: https://issues.apache.org/jira/browse/KAFKA-12585 Project: Kafka Issue Type: Bug Components: clients Affects Versions: 2.7.0, 2.5.1 Reporter: Brian Hawkins
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. -- This message was sent by Atlassian Jira (v8.3.4#803005)