kafka
protocol_error
ai_generated
true
org.apache.kafka.common.errors.RebalanceInProgressException: 正在重平衡,无法完成分配
org.apache.kafka.common.errors.RebalanceInProgressException: Rebalance in progress; cannot complete assignment
ID: kafka/rebalance-protocol-mismatch
85%修复率
88%置信度
1证据数
2024-02-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.5.0 | active | — | — | — |
| 3.6.0 | active | — | — | — |
| 3.7.0 | active | — | — | — |
根因分析
消费者组的静态成员和动态分配协议不匹配,导致重平衡循环。
English
Consumer group protocol mismatch between static membership and dynamic assignment triggers rebalance loop.
官方文档
https://kafka.apache.org/documentation/#consumerrebalance解决方案
-
设置 'partition.assignment.strategy' 为 'org.apache.kafka.clients.consumer.RangeAssignor',并确保所有消费者使用相同的协议版本。
-
从消费者配置中移除 group.instance.id 以禁用静态成员,并使用 'KafkaConsumer#enforceRebalance' 触发重平衡。
-
升级代理到 3.7+ 并使用 'CooperativeStickyAssignor' 启用协作式重平衡协议。
无效尝试
常见但无效的做法:
-
90% 失败
Restarting does not resolve protocol mismatch; rebalance triggers again on rejoin.
-
70% 失败
Longer timeout delays detection but does not fix assignment logic.
-
60% 失败
Removing static membership may cause duplicate assignments and offset commits.