A resolved issue stays unresolved in Discover when Kafka is down for more than 5 minutes after the change, and nothing repairs it
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- clickhouse, docker-compose, kafka, postgresql, python
調査の方向性
Start with src/sentry/issues/attributes.py at produce_snapshot_to_kafka and the post_update receiver; trace how the send result is handled when Kafka is unavailable. The report also points to src/sentry/api/helpers/group_index/update.py and src/sentry/search/events/builder/errors.py for the update path and Discover status mapping. Reproduce by stopping Kafka during a resolve, then verify that after it returns is:resolved finds the events and is:unresolved does not.
索引モデルが issue の本文から書いたものです。
説明
Self-Hosted Version
26.10.1
CPU Architecture
x86_64
Docker Version
29.1.3
Docker Compose Version
5.6.1
Machine Specification
- My system meets the minimum system requirements of Sentry
Installation Type
Fresh install of 26.10.1 (sentry commit 75be212fba6d4a1c43fc98030fc5e56edcdf176a) with ./install.sh, then docker compose up --wait. Only change: COMPOSE_PROFILES=errors-only in .env. No .env.custom, no override file.
Steps to Reproduce
Resolving an issue answers 200 and Postgres stores the new status. If Kafka stays down for more than 5 minutes after that, the new status never reaches the ClickHouse table group_attributes. Discover then lists the events of the resolved issue as unresolved, also after Kafka is back, and nothing sends the status again.
- Create a project and a personal token with the scopes
event:admin,event:read,org:readandproject:read. SetORG(organization slug),PID(project id),KEY(the key in the DSN) andTOKEN. Send 3 events that group into one issue and count them by status:
B=http://localhost:9000
H="Authorization: Bearer $TOKEN"
for i in 1 2 3
do
curl -s -o /dev/null -X POST "$B/api/$PID/store/?sentry_key=$KEY&sentry_version=7" -H 'Content-Type: application/json' -d '{"message":"status-repro","level":"error"}'
done
sleep 20
GID=$(curl -s -H "$H" "$B/api/0/organizations/$ORG/issues/?project=$PID&query=status-repro&statsPeriod=1h" | grep -o '"id":"[0-9]*"' | head -1 | tr -dc 0-9)
Q="$B/api/0/organizations/$ORG/events/?dataset=errors&field=id&field=issue.id&project=$PID&statsPeriod=24h"
count() {
curl -s -G -H "$H" "$Q" --data-urlencode "query=issue.id:$GID is:$1" | grep -o '"id":"[0-9a-f]\{32\}"' | wc -l
}
count unresolved # 3
count resolved # 0
- Stop Kafka and resolve the issue. Wait 5.5 minutes, then start Kafka again:
docker compose stop kafka
curl -s -o /dev/null -w '%{http_code}\n' -X PUT -H "$H" -H 'Content-Type: application/json' -d '{"status":"resolved"}' "$B/api/0/issues/$GID/" # 200
sleep 330
docker compose start kafka
- Give the services 2 minutes to reconnect, then check the issue, Discover and ClickHouse:
sleep 120
curl -s -H "$H" "$B/api/0/issues/$GID/" | grep -o '"status":"[a-z]*"' | head -n 1 # "status":"resolved"
count resolved # 0
count unresolved # 3
docker compose exec -T clickhouse clickhouse-client --query "SELECT group_status FROM group_attributes_local FINAL WHERE project_id = $PID AND group_id = $GID" # 0
Expected Result
A status change that answers 200 should reach group_attributes once Kafka is back. Discover should then list the events with is:resolved and not with is:unresolved. If the delivery fails, the status should be sent again.
Actual Result
The PUT answers 200 and the issue reads resolved. After Kafka is back, Discover lists all 3 events as unresolved and none as resolved. ClickHouse still holds status 0 (unresolved). This happened in 4 of 4 runs on 3 fresh stacks, checked for up to 19 minutes.
- A restart of
webandsnuba-group-attributes-consumerchanges nothing. - Sending the same PUT again changes nothing, because an already resolved group is skipped (update.py#L475-L477).
- Only a change of another attribute sends a new status. I set the priority to low, and then
is:resolvedlisted the events. - An issue resolved 270 seconds after Kafka stopped, 60 seconds before it came back, was delivered (2 of 2 runs). With Kafka running, a resolve shows up within seconds.
Nothing logs the loss. While Kafka is down, the web log has only librdkafka connection errors, first a refused connection, later a failed name lookup (the address is the Compose network of my run). No line says that the status was dropped:
FAIL|sentry.issues.attributes#producer-1| [thrd:kafka:9092/bootstrap]: kafka:9092/bootstrap: Connect to ipv4#192.168.0.9:9092 failed: Connection refused (after 0ms in state CONNECT)
Failed to resolve 'kafka:9092': Name or service not known
The status is sent by produce_snapshot_to_kafka, and nobody reads the result of that send (attributes.py#L113-L136, details below). Master (2f1e6fe) has the same code.
getsentry/sentry#124530 shows the same symptom on sentry.io, and getsentry/sentry#127454 added snapshots to status changes that sent none. Here the snapshot is sent and its failed delivery is dropped, so neither covers this case.
A possible fix: keep the result of the produce and send the snapshot again when it fails, or send it from a task that waits for the delivery.
Where it happens in the code
Resolving makes web send a snapshot (a message with the new status) to the Kafka topic group-attributes. snuba-group-attributes-consumer writes it to group_attributes. The send is produce_snapshot_to_kafka, called from the post_update receiver inside the request (attributes.py#L246-L253):
FutureTrackingProducer.producereturns no future (producer.py#L163-L201). The delivery callback only sets the exception on that future (consumer.py#L809-L817).- The producer sets no
message.timeout.ms, so librdkafka drops the message after 300 seconds and nobody reads the failure. - The task worker can wait for these futures when
ARROYO_TRACK_PRODUCER_FUTURESis set. A web request has no such step, and self-hosted does not set the variable. - A snapshot is sent again only when the same issue changes again.
The errors dataset maps is: and status to group_attributes.group_status (errors.py#L110-L117), so Discover, Explore and dashboards on errors keep the old status. By reading the code (I did not run it), the weekly report also picks its key error issues with group_status = UNRESOLVED (utils.py#L182-L186).
Event ID
No response
- 主要言語
- Shell
- スター
- 9.7k
- フォーク
- 2k
- 平均マージ
- 3日 2時間
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/self-hosted のほかの issue
-
Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
getsentry/self-hosted#4644 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
getsentry/self-hosted#4518 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Waiting for: Product Owner
難易度 3/5 1〜2日 初心者へのやさしさ 73/100
getsentry/self-hosted#4642 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Waiting for: Community
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
getsentry/self-hosted#4637 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Waiting for: Product Owner
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
getsentry/self-hosted#4634 ·
メンテナーはふだん 2 日以内に返信
getsentry/self-hosted の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ajithakdev/claude-desktop-rpm#43 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aws/aws-networking-best-practices#256 ·
メンテナーはふだん 2 日以内に返信
-
area:terraform source:reader type:content-error
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
stephrobert/blog-roadmap#268 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100