kafka
runtime_error
ai_generated
true
org.apache.kafka.common.errors.InvalidPartitionCountException:静态组成员的分区计数0无效
org.apache.kafka.common.errors.InvalidPartitionCountException: The partition count 0 is invalid for static group member
ID: kafka/invalid-partition-count-on-static-membership
82%修复率
85%置信度
1证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Kafka 3.5.0 | active | — | — | — |
| Kafka 3.6.0 | active | — | — | — |
| Kafka 3.7.0 | active | — | — | — |
根因分析
静态消费者组成员资格需要至少一个分区分配;计数为零表示分配策略配置错误或未初始化。
English
Static consumer group membership requires at least one partition assignment; a count of zero indicates a misconfigured or uninitialized assignment strategy.
官方文档
https://kafka.apache.org/documentation/#consumerconfigs_group.instance.id解决方案
-
Ensure the consumer subscribes to at least one topic with partitions before joining the group. Example: consumer.subscribe(Pattern.compile("my-topic-.*")); -
Set partition.assignment.strategy to a non-empty strategy like 'org.apache.kafka.clients.consumer.RangeAssignor' explicitly in consumer config.
无效尝试
常见但无效的做法:
-
Tuning consumer max.poll.records to a higher value
90% 失败
Increasing max.poll.records does not affect partition assignment count and only delays rebalance timeouts.
-
Deleting group.instance.id from consumer config
70% 失败
Removing group.instance.id disables static membership but loses group rebalance stability benefits.