I have a cluster of 3 Kafka brokers with replication factor of 3 for all topics. Since last few days I am facing this issue, suddenly(few times in a day) consumers and producers are stuck while getting response even when Kafka is running on all 3 servers which gets resolved until I check brokers logs ("Connection to 0 was disconnected before the response was read")and find out the culprit node which is 0 (1st node in this case)and restarts zookeeper and broker on that node.
As per logs it is happening due to rebalancing.
I reduces min.insync.replicas to 2, but it doesn't help.
Server logs of 0 (1st node) which caused problem in this case:
Member consumer-3-8e370c0e-4a21-4dec-8301-18ce6aaf71d9 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group banner in state PreparingRebalance with old generation 2570 (__consumer_offsets-5) (reason: removing member consumer-3-8e370c0e-4a21-4dec-8301-18ce6aaf71d9 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-da57dad3-6825-4a6d-ac93-82a29f72a3dc in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-2-812b613b-3409-42e7-baf8-8b32df4e2fa4 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-2-d03f0417-4e0f-4ab0-90c6-12b17a6354d7 in group poster has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group poster in state PreparingRebalance with old generation 191 (__consumer_offsets-9) (reason: removing member consumer-2-d03f0417-4e0f-4ab0-90c6-12b17a6354d7 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Group poster with generation 192 is now empty (__consumer_offsets-9) (kafka.coordinator.group.GroupCoordinator)
Member rdkafka-fda5cec6-e121-4ab7-9650-83d391abc82d in group notification-test has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Stabilized group notification-test generation 436 (__consumer_offsets-20) (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-eeb1b721-b52b-4b65-af70-e48a345d150f in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-889659e2-3c2f-4059-bf0c-45796f824443 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-95a38999-6156-4a53-ac1f-1d51703956fd in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Group banner with generation 2571 is now empty (__consumer_offsets-5) (kafka.coordinator.group.GroupCoordinator)
Failed to write empty metadata for group poster: The group is rebalancing, so a rejoin is needed. (kafka.coordinator.group.GroupCoordinator)
Failed to write empty metadata for group banner: The group is rebalancing, so a rejoin is needed. (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-e7a6af24-1f50-40cc-a593-cf8614e9d088 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group redemption in state PreparingRebalance with old generation 1373 (__consumer_offsets-27) (reason: removing member consumer-5-e7a6af24-1f50-40cc-a593-cf8614e9d088 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Member consumer-1-d89defb1-6637-48bc-ba16-b646c32d3849 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-c942542b-7c54-4656-a485-410278b936ec in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-3-adfb6536-2fbc-4b39-9368-56b665db2c75 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
[2019-05-19 13:22
Logs of other broker:
java.io.IOException: Connection to 0 was disconnected before the response was read
at org.apache.kafka.clients.NetworkClientUtils.sendAndReceive(NetworkClientUtils.java:97)
at kafka.server.ReplicaFetcherBlockingSend.sendRequest(ReplicaFetcherBlockingSend.scala:97)
at kafka.server.ReplicaFetcherThread.fetchFromLeader(ReplicaFetcherThread.scala:190)
at kafka.server.AbstractFetcherThread.kafka$server$AbstractFetcherThread$$processFetchRequest(AbstractFetcherThread.scala:241)
at kafka.server.AbstractFetcherThread$$anonfun$maybeFetch$1.apply(AbstractFetcherThread.scala:130)
at kafka.server.AbstractFetcherThread$$anonfun$maybeFetch$1.apply(AbstractFetcherThread.scala:129)
at scala.Option.foreach(Option.scala:257)
at kafka.server.AbstractFetcherThread.maybeFetch(AbstractFetcherThread.scala:129)
at kafka.server.AbstractFetcherThread.doWork(AbstractFetcherThread.scala:111)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:82)
Logs of consumer service:
|FAIL|rdkafka#consumer-2| [thrd:m-data-kaf006.c-14cba.internal:9092/2]: m-data-kaf006.c.internal:9092/2: 3 request(s) timed out: disconnect
Not able to find the solution for this.
Kafka version: 2.1.0
This is due to an issue in an older kafka version. You need to upgrade your kafka to 2.2.0, 2.1.1 Please find below the underlying jira issue - https://issues.apache.org/jira/browse/KAFKA-7697
I found out that there is a deadlock issue in this Kafka version (2.1.0): https://issues.apache.org/jira/browse/KAFKA-7802 It has been solved in versions 2.1.1 and 2.2.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With