---
title: "Why does my Kafka consumer keep leaving the group and rebalancing? | Proofline"
description: "A Kafka consumer that keeps rejoining its group was either too slow between two poll() calls or missed heartbeats until the coordinator removed it."
url: https://proofline.sh/learn/kafka-consumer-rebalance-loop/
---

[Learning center](/learn/)

# Why does my Kafka consumer keep leaving the group and rebalancing?

A Kafka consumer that keeps rejoining its group was either too slow between two poll() calls or missed heartbeats until the coordinator removed it. The client logs a poll timeout warning in the first case and not in the second. Read the consumer's log around one departure, then the group's state and members, before changing any timeout.

Broken dependencies The Proofline team November 23, 2026 5 min read

## Two ways out of the group

Group membership has two separate liveness checks, and each one can eject a consumer that is still running:

-   **The poll interval.** If the application does not call `poll()` within `max.poll.interval.ms` (default 300000 ms, five minutes), the client leaves the group on purpose so that another member can take its partitions. This is the usual result of slow processing: a batch of up to `max.poll.records` records (default 500) that takes longer than the interval to handle. When the application then tries to commit, it can get a `CommitFailedException`. [KafkaConsumer: detecting consumer failures](https://kafka.apache.org/44/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html) · [Consumer configs](https://kafka.apache.org/44/configuration/consumer-configs/)
-   **The session timeout.** A background thread sends heartbeats. If the coordinator receives none for the session timeout, it removes the member and rebalances. With the classic protocol the client sets `session.timeout.ms` (default 45000 ms) and `heartbeat.interval.ms` (default 3000 ms). With the newer consumer protocol (`group.protocol=consumer`) the broker sets them as `group.consumer.session.timeout.ms` (default 45000 ms) and `group.consumer.heartbeat.interval.ms` (default 5000 ms), and the client settings are not supported. Long process pauses, CPU starvation, network trouble to the coordinator and crashes all end here. [Consumer configs](https://kafka.apache.org/44/configuration/consumer-configs/) · [Broker configs](https://kafka.apache.org/44/configuration/broker-configs/) · [Consumer rebalance protocol](https://kafka.apache.org/44/operations/consumer-rebalance-protocol/)

A third, nearby cause is churn from outside: pods restarting after out-of-memory kills, a rolling deploy, or an autoscaler adding and removing members. Each join and leave triggers a rebalance even though no timeout fired.

## Why they look alike

From the group's side, all three look like members leaving and joining, partitions moving, and lag growing while partitions are reassigned. The fixes point in different directions. Raising `max.poll.interval.ms` does nothing for a consumer that misses heartbeats, and raising the session timeout does nothing for one whose batches take six minutes. Restarts need neither.

## Read the consumer's log first

The Java client logs a warning when the poll interval expires. In the classic consumer it begins `consumer poll timeout has expired. This means the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms`, and the newer consumer logs the same text with a capital C. If that line precedes each departure, the cause is processing time. [AbstractCoordinator source](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java) · [AbstractHeartbeatRequestManager source](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractHeartbeatRequestManager.java)

If the line is missing and the process was alive, look for heartbeat failures: in the classic consumer, a heartbeat that failed with an unknown member ID error and a note that the client is resetting its generation. That means the coordinator had already removed the member. If the process was not alive, the log simply stops; look at why it stopped. [AbstractCoordinator source](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java)

The client's metrics say the same thing in numbers. Under `kafka.consumer:type=consumer-metrics`, `time-between-poll-max` near or above `max.poll.interval.ms` points to slow processing. Under `kafka.consumer:type=consumer-coordinator-metrics`, `rebalance-rate-per-hour` and `failed-rebalance-total` show how often the member rebalances. [Kafka monitoring](https://kafka.apache.org/44/operations/monitoring/)

## Read the group from outside

`kafka-consumer-groups.sh` reads the group without changing it. `--state` prints the coordinator, the assignment strategy, the state and the member count; `--members` lists each member's `CONSUMER-ID`, host, client ID and partition count. Run both a few times a minute apart. [Basic Kafka operations](https://kafka.apache.org/44/operations/basic-kafka-operations/)

```
bin/kafka-consumer-groups.sh --bootstrap-server BROKER:9092 --command-config CLIENT_PROPERTIES \
  --describe --group GROUP --state
bin/kafka-consumer-groups.sh --bootstrap-server BROKER:9092 --command-config CLIENT_PROPERTIES \
  --describe --group GROUP --members
```

A healthy group reads `Stable`. A group in a loop keeps showing a rebalancing state (`PreparingRebalance` or `CompletingRebalance` for a classic group, `Assigning` or `Reconciling` for a consumer-protocol group), and the describe command warns that the group is rebalancing. New `CONSUMER-ID` values on the same host between reads mean the same process rejoined as a new member. [GroupState source](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/GroupState.java) · [ConsumerGroupCommand source](https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java)

If the consumers run on Kubernetes, check restarts and the last termination reason. An out-of-memory kill shows `OOMKilled` with exit code 137. [Assign memory resources](https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/)

```
kubectl get pods --namespace NAMESPACE --selector app=CONSUMER_APP
kubectl get pod POD --namespace NAMESPACE --output jsonpath='{.status.containerStatuses[*].lastState.terminated}'
```

## Decide which timeout fired

| Consumer log | Time between polls | Pod restarts | Points to |
| --- | --- | --- | --- |
| Poll timeout warning | Above the interval | None | Slow processing per batch |
| Heartbeat failed, generation reset | Normal | None | Session timeout: pauses or network |
| Log stops, then a fresh start |  | Rising | Crashes or restarts |
| Nothing unusual | Normal | None, but members change | Deploys or autoscaling |

## A worked example: two rebalance loops

This example is illustrative. The fictional group `payments-settler` has four members on Kubernetes, reading `payments` with the classic protocol and default timeouts. Both incidents show the group rebalancing every few minutes from 14:00 UTC.

In the first incident, each member logs `consumer poll timeout has expired` about five minutes after its last poll, then rejoins. `time-between-poll-max` reads 325 seconds. Since 14:00, each record waits on a fraud API call that takes about 650 ms, and a full batch of 500 records needs about 325 seconds. The member leaves, rejoins, receives a batch, and runs out of time again. The fix is on the consumer: smaller batches through `max.poll.records`, or processing off the poll thread with paused partitions as the client documentation describes. Then ask why the fraud API slowed down: [is the latency the client's or the server's?](/learn/dependency-latency-client-or-server/)

In the second incident, no poll timeout warning appears. Pod restarts climb, and the last termination reads `OOMKilled`, exit code 137. Each restart removes a member and adds a new one. No timeout setting will help; the memory limit or the consumer's memory use is the problem.

## Limits

The log lines quoted here come from the Java client. Other clients use their own wording and settings, so check their documentation for the equivalents. With static membership (`group.instance.id`), a member that exceeds the poll interval does not lose its partitions at once; they move after the session timeout. A loop also produces lag, so a lag alarm may be the first thing you see: [lag from stalled or slow consumers](/learn/kafka-consumer-lag-stalled-or-slow/). [Consumer configs](https://kafka.apache.org/44/configuration/consumer-configs/)

If the loop began with a consumer release, [compare the old and new revisions](/learn/bad-release-or-unhealthy-dependency/). Other dependency failures are covered in [diagnosing runtime dependency failures](/learn/runtime-dependency-failures/).

## Questions

### What is the default max.poll.interval.ms in Kafka?

300000 ms, five minutes. If the application does not call `poll()` within that time, the consumer leaves the group and its partitions are reassigned.

### Does session.timeout.ms apply with the new consumer protocol?

No. With `group.protocol=consumer`, the session timeout and heartbeat interval are broker settings, `group.consumer.session.timeout.ms` and `group.consumer.heartbeat.interval.ms`. The client's `session.timeout.ms` and `heartbeat.interval.ms` are not supported there.

### Should I just raise max.poll.interval.ms?

Only if each batch's processing time is known and bounded. A larger value also delays rebalances, because a member joins a rebalance only inside `poll()`. Smaller batches or processing on another thread address the cause.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Is Kafka consumer lag growing because consumers stalled or are slow?](/learn/kafka-consumer-lag-stalled-or-slow/)
    
    Broken dependencies The Proofline team November 23, 2026 5 min read
    
-   ### [Dependency slow for the client but fast on the server](/learn/dependency-latency-client-or-server/)
    
    Network outages The Proofline team November 23, 2026 6 min read
