Scenario 04.2.4 · Transaction timeout
Kafka transaction.timeout.ms: the coordinator aborts
An open transaction left unresolved past transaction.timeout.ms is auto-aborted by the coordinator; the LSO releases and an epoch bump fences the producer.
Run this scenario in the playgroundCluster ready · txn timeout armed. t+0.000s
orders has 1 partition, RF=3. transaction.timeout.ms is 2000 ms. A transactional producer tx1 is idle; group rc is read_committed. Press ▶.
Open at this step: step 1, Cluster ready · txn timeout armedOpen · uncommitted, timer running. t+1.000s
tx1 began a transaction (the simulator schedules its txn_timeout for 2100, begin + 2000 ms; Kafka would count from the first partition added, at 200) and wrote offset 0. The record is replicated (HW advanced) but the LSO is held at 0 - read_committed sees nothing while the timer counts down.
Open at this step: step 2, Open · uncommitted, timer runningTimed out · auto-aborted. t+2.600s
tx1 never committed. Once transaction.timeout.ms passed, the coordinator's periodic check auto-aborted it: the offset-0 record becomes an aborted range, the LSO releases to the high watermark, and tx1 is errored (the simulator calls it transaction_timed_out; Kafka bumps the epoch, so tx1's next send or commit fails with an epoch error). read_committed skips the aborted record entirely.
Open at this step: step 3, Timed out · auto-abortedWhat you start with
A producer opens a transaction and then never commits or aborts it. The transaction coordinator enforces transaction.timeout.ms, counted from when the first partition joins the transaction: once it expires, its next periodic check auto-aborts the abandoned transaction on the producer's behalf.
Step by step
- Cluster ready · txn timeout armed t+0.000s orders has 1 partition, RF=3. transaction.timeout.ms is 2000 ms. A transactional producer tx1 is idle; group rc is read_committed. Press ▶. Open at this step: step 1, Cluster ready · txn timeout armed
- Open · uncommitted, timer running t+1.000s tx1 began a transaction (the simulator schedules its txn_timeout for 2100, begin + 2000 ms; Kafka would count from the first partition added, at 200) and wrote offset 0. The record is replicated (HW advanced) but the LSO is held at 0 - read_committed sees nothing while the timer counts down. Open at this step: step 2, Open · uncommitted, timer running
- Timed out · auto-aborted t+2.600s tx1 never committed. Once transaction.timeout.ms passed, the coordinator's periodic check auto-aborted it: the offset-0 record becomes an aborted range, the LSO releases to the high watermark, and tx1 is errored (the simulator calls it transaction_timed_out; Kafka bumps the epoch, so tx1's next send or commit fails with an epoch error). read_committed skips the aborted record entirely. Open at this step: step 3, Timed out · auto-aborted
The takeaway
The coordinator writes abort markers, the LSO is released and the epoch bump fences the producer, which finds out on its next operation - an abandoned transaction can never pin the LSO indefinitely.
Configs in this scenario
-
transaction.The longest a transaction may stay open, counted from the first partition added to it, before the transaction coordinator aborts it (default 60000, 1 minute); it may not exceed the broker transaction.max.timeout.ms.timeout. ms
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=04.2.4" title="Kafka Simulator: Transaction timeout" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/txn-timeout/">Kafka transaction.timeout.ms: the coordinator aborts</a></p> Further reading
Troubleshooting
More in Transactions
- Kafka at-most-once vs at-least-once vs exactly-once
- At-least-once delivery in Kafka: where duplicates come from
- Kafka transaction commit vs abort with read_committed
- Kafka isolation.level: read_committed vs read_uncommitted
- Kafka last stable offset (LSO) with concurrent transactions
- Kafka read_committed during a leader election
- Kafka consume-process-produce loop with exactly-once
- Kafka zombie producer fencing with transactional.id
- Kafka processing.guarantee=exactly_once_v2 end to end