title: Consumer and producer failing with error: "Connection to 0 was disconnected before the response was read"
body: <p>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. </p>
  
  <p>As per logs it is happening due to rebalancing. </p>
  
  <p>I reduces min.insync.replicas to 2, but it doesn't help.  </p>
  
  <p>Server logs of 0 (1st node) which caused problem in this case:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Logs of other broker: </p>
  
  <pre><code>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)
  
  </code></pre>
  
  <p>Logs of consumer service:</p>
  
  <pre><code>|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
  </code></pre>
  
  <p>Not able to find the solution for this.</p>
  
  <p>Kafka version: 2.1.0</p>