---
title: "KafScale 2.1 diskless Kafka: a paused broker comes back"
description: "KafScale 2.1: a broker paused past its lease drops its partition log on resume and restores from etcd and S3, so nothing acked is overwritten."
url: https://monedula.dev/kafka-simulator/scenarios/kafscale-2-paused-broker/
---

# KafScale 2.1 diskless Kafka: a paused broker comes back

Scenario 08.2.7 · KafScale: a paused broker comes back without overwriting. Diskless · Advanced · about 4 min · Apache Kafka 4.4 · KafScale 2.1.

KafScale 2.1 · a broker paused past its lease drops its partition log when it resumes; when the partition comes back to it, it restores from etcd and S3 and writes at the right offset.

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

## What you start with

A paused broker is a frozen process: SIGSTOP, or a long garbage collection pause. Its partition leases expire after the 10 s TTL and another broker takes over. A resumed broker that kept its old partition log could write at a stale offset over records another broker acked (KafScale issue #324), so KafScale drops the log when the lease is lost and reloads it from etcd and S3 on the next acquisition. broker-2 owns orders and is paused; later it resumes and broker-1 is stopped for a rolling restart. Watch the lease lane, the restore, and the segment keys in the object storage lane.

## Step by step

1. **broker-2 owns orders-0** (t+1.100s): orders is a KafScale topic (KafScale 2.1) with one partition. p1 sent order-1 at 100 ms: broker-2 took the lease, gave it offset 0 and was acked at 790 ms; c1 read it at 1000 ms. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=0)
2. **broker-2 is paused** (t+2.100s): broker-2 was paused at 1500 ms. It sends no keepalives, so its lease on orders-0 expires at 11500 ms; until then requests for orders-0 still go to broker-2. p1's order-2 got REQUEST_TIMED_OUT at 2050 ms and is retried every 500 ms; c1's fetch timed out at 2000 ms. A real client waits request.timeout.ms (30 s by default) per attempt. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=1)
3. **broker-1 took over** (t+13.100s): The lease expired at 11500 ms. p1's retry at 11550 ms made broker-1 take it and restore orders-0 (etcd end 1, S3 end 1): order-2 got offset 1 and was acked at 12190 ms, and c1 read it at 13000 ms. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=2)
4. **broker-2 resumes** (t+14.100s): broker-2 resumed at 14000 ms after 12.5 s. Its etcd session is gone, so KafScale 2.1 dropped its partition log for orders-0: it owns nothing and holds nothing. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=3)
5. **broker-1 stops gracefully** (t+15.100s): broker-1 was stopped gracefully at 15000 ms, as in a rolling restart. Nothing was in flight, so it released its lease at once. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=4)
6. **A restore, then the right offset** (t+16.300s): p1 sent order-3. At 15550 ms it went to broker-2, which took the lease with a new acquisition and restored orders-0 from etcd and S3 (both at 2): order-3 got offset 2, under its own segment key orders/0/segment-00000002, and was acked at 16190 ms. The end offset is 3. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=5)
7. **Nothing acked was lost** (t+20.100s): c1 read order-3 at 17000 ms. g2 started at 17000 ms from the start and read order-1, order-2 and order-3, one per poll. Each record was acked once at its own offset, and nothing in S3 was replaced. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=08.2.7&t=6)

## The takeaway

broker-2 dropped its partition log when it resumed, because its etcd session had expired. When orders-0 came back to it, it restored from etcd and S3 (both at 2) and wrote order-3 at offset 2, under its own segment key. Each record was acked once at its own offset, nothing in S3 was replaced, and both consumers read order-1, order-2 and order-3. Not shown: a write in flight at the pause. KafScale fences it: the produce gets NOT_LEADER_OR_FOLLOWER, or KAFKA_STORAGE_ERROR when the segment PUT finds the key taken (If-None-Match); scenario 08.2.6 shows that fence after a graceful stop. At the commit the simulator reads, such a conflict also blocked the broker's produces for 60 s (issue #335), fixed in the 2.0 release (PR #345). Simulator choices: in-flight work fails at the pause, a request to a paused broker times out at once, the lease TTL counts from the pause, the resumed broker notices its lost session at once, and a stable hash stands in for the proxy's round-robin.

## Configs in this scenario

- [`request.timeout.ms`](https://kafka.apache.org/44/configuration/producer-configs/#producerconfigs_request.timeout.ms): How long the client waits for the response to one request before it sends it again or fails it (default 30000, 30 seconds); for a producer it should stay above the broker replica.lag.time.max.ms to avoid retries that write duplicates.

## Further reading

- [KafScale v2.1.0 source on GitHub](https://github.com/KafScale/platform/blob/v2.1.0/pkg/metadata/lease_manager.go)

## Troubleshooting

- [TimeoutException in Kafka producers: causes and fixes](https://monedula.dev/kafka/troubleshooting/producer-timeout-exception/)
