Multiple Sentry consumers repeatedly become unhealthy due to Kafka coordinator/session timeouts

未关闭
#4,485 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
docker, docker-compose, kafka

调研方向

从附加的日志和标准 Docker Compose 配置开始,重点关注 Kafka coordinator 超时、consumer rebalance,以及 Sentry 和 Snuba consumer 中容器转为 unhealthy 的状态转换。比较受影响的 consumer 服务,并确定一种可复现的配置或恢复更改;当 consumer 保持健康状态并且无需手动重启即可持续处理消息时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Waiting for: Product Owner
Self-Hosted Version

26.8

CPU Architecture

x86_64

Docker Version

29.7.2

Docker Compose Version

v5.5.0

Machine Specification
  • My system meets the minimum system requirements of Sentry
Installation Type

Upgrade from 26.7.2

Steps to Reproduce
  1. Deploy a self-hosted Sentry installation using the standard Docker Compose configuration.

  2. Start all Sentry services and verify that the consumers initially become healthy.

  3. Leave the Sentry installation running under normal workload.

  4. Allow the Sentry consumers to process events, performance metrics, buffered segments, monitor tasks, and other Kafka topics.

  5. After some time, multiple consumers begin losing communication with the Kafka consumer group coordinator.

  6. The issue can be observed in the logs with messages such as:

    Consumer group session timed out (in join-state steady) after 45000 ms
    without a successful response from the group coordinator
    
  7. The consumers subsequently report errors such as:

    KafkaError{code=NOT_COORDINATOR}
    KafkaError{code=_WAIT_COORD}
    KafkaError{code=COORDINATOR_LOAD_IN_PROGRESS}
    
  8. The affected containers eventually become unhealthy.

  9. Restarting the Sentry stack temporarily restores the consumers to a healthy state.

  10. The problem recurs several times per day, requiring approximately 4 Sentry restarts per day.

Affected containers include:

sentry-snuba-subscription-consumer-events-1
sentry-process-segments-1
sentry-post-process-forwarder-errors-1
sentry-monitors-clock-tasks-1
sentry-ingest-monitors-1
sentry-generic-metrics-consumer-1
sentry-events-consumer-1

The issue also affects Snuba's Kafka consumer for:

snuba-commit-log
Expected Result

Sentry consumers should remain connected to their Kafka consumer groups and continue processing messages normally during continuous operation.

The consumer containers should remain healthy and should not require manual restarts.

Temporary Kafka coordinator changes or consumer group rebalances should recover automatically without causing the containers to become unhealthy.

Actual Result

Multiple Sentry consumers periodically lose communication with the Kafka group coordinator and experience approximately 45-second consumer session timeouts.

The logs contain messages such as:

Consumer group session timed out (in join-state steady) after 45000 ms
without a successful response from the group coordinator

followed by:

Broker: Not coordinator
Local: Waiting for coordinator

and:

Broker: Coordinator load in progress

The consumers revoke their Kafka partitions and attempt to rejoin the consumer group.

For example:

Partitions to revoke:
[Partition(topic=Topic(name='events'), index=0)]

and:

Commit failed:
KafkaError{code=_WAIT_COORD,val=-180,str="Local: Waiting for coordinator"}

Snuba exhibits the same behavior on snuba-commit-log, suggesting that the problem is not isolated to a single Sentry consumer.

Additionally, sentry-process-segments-1 frequently reports processing delays such as:

Batch process is taking longer than 5 seconds.

and:

Waited on the process pool longer than 20 seconds.
Waiting for 1 results.

After these Kafka coordinator/session problems, multiple containers become unhealthy.

Restarting the Sentry stack temporarily resolves the problem, but the same behavior returns several times per day, requiring approximately 4 manual restarts per day.

_sentry-process-segments-1_logs.txt
_sentry-post-process-forwarder-errors-1_logs.txt
_sentry-monitors-clock-tasks-1_logs.txt
_sentry-ingest-monitors-1_logs.txt
_sentry-generic-metrics-consumer-1_logs.txt
_sentry-events-consumer-1_logs.txt
_sentry-snuba-subscription-consumer-events-1_logs.txt

Event ID

No response

主要语言
Shell
星标
9.7k
派生
2k
平均合并
3 天 2 小时
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/self-hosted 的其他 Issue

查看 getsentry/self-hosted 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。