kafka
runtime_error
ai_generated
true
org.apache.kafka.common.errors.OffsetCommitRejectedException: 由于时代被隔离,偏移量提交被拒绝
org.apache.kafka.common.errors.OffsetCommitRejectedException: Offset commit rejected due to fenced epoch
ID: kafka/offset-commit-rejected-fenced
82%修复率
86%置信度
1证据数
2024-01-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.5.0 | active | — | — | — |
| 3.6.0 | active | — | — | — |
根因分析
消费者组协调器拒绝了偏移量提交,因为消费者的时代已过时,这是由于较新的消费者实例接管导致的。
English
Consumer group coordinator rejected offset commit because the consumer's epoch is stale due to a newer consumer instance taking over.
官方文档
https://kafka.apache.org/documentation/#consumerconfigs_group.id解决方案
-
确保每个消费者实例使用唯一的 group.instance.id,以避免时代冲突;使用基于UUID的ID。
-
捕获 OffsetCommitRejectedException 并使用新的消费者实例重新加入组。
-
设置 'group.protocol' 为 'consumer',并通过移除 group.instance.id 禁用静态成员。
无效尝试
常见但无效的做法:
-
85% 失败
Manual commit still uses same epoch; coordinator rejects if epoch is fenced.
-
70% 失败
Longer interval delays rebalance but does not fix epoch fencing from duplicate consumers.
-
60% 失败
Deleting offsets resets group but does not prevent future fencing if same consumer ID is used.