kafka protocol_error ai_generated true

org.apache.kafka.common.errors.FetchSessionIdNotFoundException: 未找到拉取会话 123456789

org.apache.kafka.common.errors.FetchSessionIdNotFoundException: Fetch session 123456789 not found

ID: kafka/fetch-session-id-not-found

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2023-08-22首次发现

版本兼容性

版本状态引入弃用备注
2.4.0 active — — —
3.0.0 active — — —
3.3.0 active — — —

根因分析

消费者拉取会话因不活动或代理重启而过期或被驱逐,导致拉取请求使用了过期的会话ID。

English

Consumer fetch session expired or was evicted on broker due to inactivity or broker restart, causing fetch request with stale session ID.

generic

官方文档

https://kafka.apache.org/documentation/#fetchsession

解决方案

  1. 增加代理的 max.incremental.fetch.session.cache.slots 到更高值(例如2000),以防止高负载下会话被驱逐。
  2. 通过增加 fetch.min.bytes 和 fetch.max.wait.ms 来减少消费者拉取请求频率,从而减少会话波动。
  3. 升级到Kafka 3.4+,该版本具有改进的驱逐逻辑,拉取会话处理更健壮。

无效尝试

常见但无效的做法:

  1. 80% 失败

    Longer wait does not prevent session eviction; broker still evicts after max.incremental.fetch.session.cache.slots.

  2. 95% 失败

    Disabling fetch session requirement is not a valid config; causes broker startup failure.

  3. 70% 失败

    Restart creates new session temporarily but error reoccurs if broker evicts again; not a fix.