---
title: "Kafka max.poll.interval.ms: evicting a stuck consumer"
description: "A stuck consumer still heartbeats, so session.timeout.ms never fires. Its partition lags until max.poll.interval.ms expires and the consumer leaves the group."
url: https://monedula.dev/kafka-simulator/scenarios/max-poll-interval/
---

# Kafka max.poll.interval.ms: evicting a stuck consumer

Scenario 02.3.2 · Stuck consumer & max.poll.interval.ms. Consumer groups · Intermediate · about 3 min · Apache Kafka 4.3.

A consumer stuck processing keeps its session alive (it heartbeats) but stops polling - its partitions lag - until max.poll.interval.ms elapses and it leaves the group, handing its partitions to a survivor.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=02.3.2

## What you start with

A consumer stuck in processing still sends heartbeats, so session.timeout.ms never fires - but it stops calling poll(). max.poll.interval.ms is the separate guard: when too long passes between polls, the consumer's heartbeat thread leaves the group and its partitions are reassigned to a survivor.

## Step by step

1. **Two-member group ready** (t+0.000s): A 2-partition topic with a cooperative-sticky group of two consumers: c1 owns p0, c2 owns p1. max.poll.interval.ms is 2000 ms. Press play. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.3.2&t=0)
2. **Both consuming · lag 0** (t+0.900s): One record landed on each partition; c1 drained p0 and c2 drained p1. Both members are caught up. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.3.2&t=1)
3. **c1 stuck processing · p0 stalls, c2 keeps consuming** (t+2.500s): c1 got stuck processing at t=1000. It still heartbeats (its session never times out) and still owns p0, but it no longer polls - so new records on p0 are NOT consumed and its lag grows, while c2 keeps draining p1. Unlike a crash, the member is alive: this is the max.poll.interval.ms failure, not session.timeout.ms. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.3.2&t=2)
4. **Evicted · survivor took over** (t+4.000s): At t=3000 max.poll.interval.ms expired: c1's heartbeat thread left the group (max.poll.interval.ms exceeded) and p0 rebalanced onto the survivor c2, which now owns both partitions and has drained p0 back to lag 0 - the same revoke→assign rebalance a crash eviction uses. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.3.2&t=3)

## The takeaway

Heartbeats prove a consumer is alive; max.poll.interval.ms proves it is making progress - a slow record handler can be evicted for stalling even while it heartbeats normally.

## Configs in this scenario

- [`max.poll.interval.ms`](https://kafka.apache.org/43/configuration/consumer-configs/#consumerconfigs_max.poll.interval.ms): The longest a group member may go between poll() calls before it counts as failed and the group rebalances its partitions to other members (default 300000, 5 minutes); a static member keeps them until its session times out. [How max.poll.interval.ms works](https://monedula.dev/kafka-simulator/configs/max-poll-interval-ms/)
- [`session.timeout.ms`](https://kafka.apache.org/43/configuration/consumer-configs/#consumerconfigs_session.timeout.ms): How long the group coordinator waits for a heartbeat from a classic-protocol consumer before it removes the member and rebalances (default 45000, 45 seconds); with group.protocol=consumer the broker group.consumer.session.timeout.ms applies instead. [How session.timeout.ms works](https://monedula.dev/kafka-simulator/configs/session-timeout-ms/)

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/43/configuration/consumer-configs/#consumerconfigs_max.poll.interval.ms)

## Troubleshooting

- [Kafka consumer group keeps rebalancing: causes and fixes](https://monedula.dev/kafka-simulator/troubleshooting/consumer-group-keeps-rebalancing/)
- [Kafka consumer lag keeps growing: causes and fixes](https://monedula.dev/kafka-simulator/troubleshooting/consumer-lag-keeps-growing/)
