Monedula

Scenario 04.2.4 · Transaction timeout

Kafka transaction.timeout.ms: the coordinator aborts

Transactions · Advanced · about 3 min · Apache Kafka 4.3

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 playground

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

What 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

  1. 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
  2. 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
  3. 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

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

Apache Kafka documentation

Troubleshooting

More in Transactions

All scenarios