title: Kafka continuous rebalancing when slow consumer
body: <p>I've been trying to test our Kafka for some negative scenarios and one of them is a very slow consumer. I set <code>Thread.sleep(15000)</code> inside my <code>@KafkaListener</code> method(it's <code>spring-kafka</code>) and set the concurrency to 3. I have 1 topic with 1 partition.
  I put 10 messages into the topic and started the service.
  When 3 consumers start, they all get to <code>(Re-)joining group</code> point,
  but then only one of them(let's assume it's <code>consumer-2</code>) will get to:</p>
  
  <pre><code>Successfully joined group with generation X
  </code></pre>
  
  <p>And start slowly consuming the messages.</p>
  
  <p>(by the way, I use MANUAL_IMMEDIATE Ack mode, but it is reproducible even when I don't add <code>Acknowledgement</code> argument to the listener and don't acknowledge messages).
  What I see next is as follows:
  Up untill all messages are rpocessed by consumer-2, every 3 seconds(default heartbeat interval) I've got a message in the console:</p>
  
  <pre><code>AbstractCoordinator$HeartbeatResponseHandler: [Consumer clientId=consumer-2, groupId=pixel-group] Attempt to heartbeat failed since group is rebalancing
  </code></pre>
  
  <p>I wonder why it happens. Only after all 10 messages are processes, there will be another rebalancing after which all 3 consumers will print:</p>
  
  <pre><code>Successfully joined group with generation X
  </code></pre>
  
  <p>And one of them will be assigned a partition and there will be no heartbeat problems any longer.
  This only happens when I set the sleep interval to a value higher than heartbeat interval. It usually happens once when all consumers are starting, but they will set up successfully shortly afterwards.</p>
  
  <p><strong>So, to sum it up it seems that:</strong></p>
  
  <p>If consumer processing time <code>&gt;</code> heartbeat interval time - all but first consumer can't finish rebalancing(they probably can't talk to their slow Leader).
  What I fail to understand is why this heartbeat error is so persistent?
  Why can't the rest of the consumers finish rebalancing somewhere in between Leader's message consumption if the sleep if longer than heartbeat?</p>
  
  <p><strong>UPDATE</strong>
  Kafka version 2.12-2.2.0
  Spring-Kafka 2.2.3.RELEASE</p>