A resolved issue stays unresolved in Discover when Kafka is down for more than 5 minutes after the change, and nothing repairs it
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- clickhouse, docker-compose, kafka, postgresql, python
- Área
- backend, databases, distributed-systems
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Shell
- Estrellas
- 9.7k
- Forks
- 2k
- Merge medio
- 3 d 2 h
- PR fusionados (30 d)
- 16
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/self-hosted
-
Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getsentry/self-hosted#4644 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
getsentry/self-hosted#4518 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
Waiting for: Product Owner
Dificultad 3/5 1-2 días Aptitud para principiantes 73/100
getsentry/self-hosted#4642 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
Waiting for: Community
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
getsentry/self-hosted#4637 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Waiting for: Product Owner
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
getsentry/self-hosted#4634 ·
Los mantenedores suelen responder en 2 días
Todos los issues de getsentry/self-hosted
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
ajithakdev/claude-desktop-rpm#43 ·
Los mantenedores suelen responder en 1 día
-
documentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws/aws-networking-best-practices#256 ·
Los mantenedores suelen responder en 2 días
-
area:terraform source:reader type:content-error
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
stephrobert/blog-roadmap#268 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
ChatGPT directory is behind mainAbiertoopenai-directory
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100