Kafka consumers never recover after SESSTMOUT caused by SQLite pool stall, taskbroker stays up without consumers

Abierto
#4,569 4 comentarios 2 reacciones 0 asignados Ver en GitHub

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
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
docker-compose, kafka, sqlite

Línea de trabajo

Start by tracing taskbroker's Kafka consumer lifecycle and how it handles librdkafka session timeouts and consumer group rejoining; the issue names no source files or tests, so locate those entry points in the taskbroker code first. Reproduce or inspect recovery after a SQLite pool stall, then confirm consumers rejoin or taskbroker exits when recovery fails. The issue gives no test command or specific completion test.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Waiting for: Product Owner
Self-Hosted Version

26.9.0

CPU Architecture

x86_64

Docker Version

29.9.1

Docker Compose Version

5.6.0

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

Upgrade path 26.4.2 -> 26.5.0 -> 26.7.0 -> 26.7.1 -> 26.9.0

Steps to Reproduce
Environment
  • Sentry self-hosted 26.9.0 (taskbroker 26.9.0), Docker Compose
  • Store adapter: sqlite, delivery_mode: pull
  • Host: 4 vCPU, 39 GiB RAM, Ubuntu (kernel 6.8)
  • Relevant config: kafka_session_timeout_ms: 60000, full_vacuum_on_upkeep: true, vacuum_interval_ms: 30000, full_vacuum_on_start: true
Problem

After a short stall of taskbroker's SQLite connection pool, all Kafka consumers hit a session timeout, shut down, and never rejoin their consumer groups. The taskbroker process keeps running, so the container looks healthy (the self-hosted service has no healthcheck), but no tasks are consumed anymore:

Consumer group 'taskworker' has no active members.
taskworker  taskworker  0  29758613  29759816  1203  -  -  -

Tasks pile up in Kafka until taskbroker is restarted manually. On self-hosted this eventually stops ingestion entirely: Relay can no longer fetch project configs (error fetching project state …: deadline exceeded), because the config computation tasks never run.

This happened twice within ~10 hours, with an identical sequence both times.

Logs (second occurrence, UTC)
09:55:03  ERROR get_task: taskbroker::grpc::server: Unable to retrieve pending activation: pool timed out while wa…
09:55:04  ERROR reduce:flush_reducer:flush: taskbroker::kafka::activation_writer: Unable to write …
09:55:07  ERROR reduce:flush_reducer:flush: taskbroker::kafka::activation_writer: Unable to write …
09:55:08  WARN  taskbroker: failed to run maintenance vacuum pool timed out while waiting for an open connection
09:55:14  WARN  upkeep::do_upkeep:handle_processing_deadline: sqlx::pool::acquire: acquired connection, but time to acquire exceeded slow threshold
09:55:14  WARN  vacuum_db: sqlx::pool::acquire: acquired connection, but time to acquire exceeded slow threshold
09:56:15  WARN  librdkafka: SESSTMOUT [thrd:main]: Consumer group session timed out (in join-state steady) …
09:56:17  WARN  librdkafka: SESSTMOUT … (repeated for every consumer/topic)
          INFO  handle_events: taskbroker::kafka::consumer: Received event: Revoke(…)
          INFO  handle_events:shutdown: taskbroker::kafka::consumer: Actor shutdown …
          INFO  pre_rebalance: taskbroker::kafka::consumer: Rendezvous complete

After the last Rendezvous complete, taskbroker logs nothing at all until it is restarted. The first occurrence (23:32:55 → SESSTMOUT at 23:34:15) looks exactly the same.

Observations
  • The SESSTMOUT comes almost exactly 60 s (kafka_session_timeout_ms) after the pool recovers.
  • Shorter pool stalls (time to acquire exceeded slow threshold) happen several times a day (e.g. 04:16, 04:53, 07:59, 09:21, 09:49 UTC) and usually recover on their own. vacuum_db is involved in every one of them.
  • The SQLite DB is tiny (28 KB + 4 MB WAL), so size is not the issue.
  • The host was not overloaded (CPU ~60–75% idle, low iowait and disk util per sar). Only taskbroker logged timeouts; all other Kafka consumers on the host (Snuba, Sentry consumers) were unaffected.
  • My guess is that the frequent full VACUUM, possibly combined with a short disk latency spike, holds the database long enough to block everything else, but I can't prove that.
Expected behavior

A temporary SQLite stall should not permanently disable all consumers. After a session timeout, taskbroker should either rejoin the consumer groups or exit with an error so the container gets restarted. A healthcheck that detects "no active consumers" would also make this visible.

Workaround

A cron job runs kafka-consumer-groups --describe --group taskworker every 5 minutes and restarts taskbroker if it reports "has no active members" twice in a row. This is confirmed working and limits the outage to ~10 minutes.

Related: getsentry/self-hosted#4424 (where I first reported the resulting backlog)

Expected Result

see above

Actual Result

see above

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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/self-hosted

Todos los issues de getsentry/self-hosted

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.