kafka
runtime_error
ai_generated
true
org.apache.kafka.common.errors.TransactionTimeoutException: 事务已超时并被中止。
org.apache.kafka.common.errors.TransactionTimeoutException: The transaction has timed out and has been aborted.
ID: kafka/transaction-aborted-due-to-timeout
82%修复率
88%置信度
1证据数
2023-06-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kafka 2.5.0 | active | — | — | — |
| Kafka 3.1.0 | active | — | — | — |
| Kafka 3.5.0 | active | — | — | — |
根因分析
Kafka 事务性生产者在提交前超过了 `transaction.timeout.ms` 的限制,导致协调器中止了该事务。
English
A Kafka transactional producer exceeded `transaction.timeout.ms` before committing, causing the coordinator to abort the transaction.
官方文档
https://kafka.apache.org/documentation/#transaction_config解决方案
-
Increase `transaction.timeout.ms` in the producer config (e.g., `transaction.timeout.ms=120000`) to accommodate longer-running transactions, and ensure the commit logic completes within this window.
-
Optimize the transaction logic—e.g., reduce the number of partitions or messages per transaction, or use asynchronous commits where possible.
无效尝试
常见但无效的做法:
-
Setting `transaction.timeout.ms` to an extremely low value to speed up transactions
80% 失败
A very low timeout increases the risk of aborts under normal load, making the system unstable.
-
Disabling idempotence to bypass transaction timeout checks
95% 失败
Transactions require idempotence; disabling it will cause configuration errors and break transactional guarantees.