Self-hosted Sentry: ingestion pipeline (relay ↔ web) silently fails after ~18–24h uptime, recurring, no clear root cause found after extensive investigation

Aperta
#4,433 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
docker, docker-compose, kafka, nginx

Direzione di ricerca

Inizia dal log di disconnessione del producer Kafka di taskscheduler e confronta il comportamento dell'health-check di project-config e del backlog di relay durante un'esecuzione di 18–24 ore. Esamina le impostazioni della connessione del producer di relay/taskworker e il comportamento del bridge Docker; il lavoro è completato quando il problema viene riprodotto e viene stabilita una correzione verificata di reconnect, keepalive o networking, con gli offset di ingestion che avanzano dopo un uptime prolungato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Waiting for: Product Owner
Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

What are you trying to accomplish?

Keep our self-hosted Sentry ingestion pipeline running reliably. We're trying to diagnose and report a recurring failure where event ingestion silently stops completely, roughly every 18–24 hours, requiring a full manual restart of relay, web, and all Kafka-touching consumers to recover — with zero human interaction in between failures (confirmed it fails again overnight, unattended).

How are you getting stuck?

relay stops successfully fetching project config from web, even though every individual component tests healthy in isolation:

  • relay logs ERROR relay_server::services::health_check: Health check probe 'auth' failed
  • relay logs a continuous, steady-state backlog (~150–270 entries, cycling) of:
  WARN relay_server::services::projects::source::upstream: error fetching project state <key>: deadline exceeded errors=0 pending=N tags.did_error=false tags.was_pending=true
  • web responds correctly and fast to both unauthenticated (401 in ~0.1–0.4s) and simple authenticated requests tested via curl from another container (nginx) hitting web:9000 directly on the same Docker bridge network
  • Kafka accepts manual produces instantly via kafka-console-producer throughout the outage
  • No offsets advance on ingest-events / ingest-transactions / ingest-attachments during the outage — relay never forwards anything downstream, despite still returning 200/event-IDs at the public ingestion edge (nginx → relay /api/N/envelope/ and /store/)

Trigger evidence found: in taskscheduler (long-running, Celery-beat-equivalent):

%6|...|FAIL|sentry.taskworker.taskworker#producer-1| [thrd:kafka:9092/1001]: kafka:9092/1001: Disconnected: connection closed by peer: receive 0 after POLLIN (after 66577654ms in state UP)

66577654ms ≈ 18.5 hours — a long-lived Kafka client connection was in UP state for ~18.5h before the remote peer (Kafka) closed it, discovered only on next use, no proactive reconnect. This periodicity matches the observed failure interval stack-wide.

What we've ruled out (across incidents on 07-17, 07-21, 07-22, 07-24):

Area | Check | Result -- | -- | -- Kafka broker | GC/heap, disk/fsync, KRaft quorum, ISR/replication, controller logs at failure timestamps | Clean every time Kafka data | Full volume wipe + rebuild from empty | Same failure recurs Postgres | Connections (8/100), locks, query duration | Clean Redis | Memory (8.5MB/10GB), eviction stats | Clean Relay credentials | Keypair vs. sentry_relay DB row | Exact match Clock sync | relay/web/host | No skew Relay process | File descriptors (22), threads (18) | Normal Host networking | iptables/firewalld, nf_conntrack_tcp_timeout_established (432000s), tcp_keepalive_time (7200s) | Stock defaults Kafka broker logs | Full unfiltered logs at exact disconnect timestamps | Only routine log-cleaner activity, no restarts/controller events/connection-close lines getsentry/self-hosted#3330 workaround | health.max_memory_percent, spool.envelopes | Applied, no change Relay image freshness | docker image inspect | Unchanged 2+ weeks, rules out bad nightly pull as trigger

Open question: no broker-side or host-conntrack evidence explains why Kafka closed this connection at ~18h. Either a gap in librdkafka's keepalive/reconnect handling for long-idle producer connections, or Docker Engine silently dropping long-idle bridge/NAT state without notifying either endpoint. Would help to know if relay/taskworker's Kafka producer clients set explicit socket.keepalive.enable or an idle-connection-max equivalent, and whether there's a known interaction with Docker bridge networking under long uptime.

Where in the product are you?

Other

Link

No response

DSN

https://[email protected]/3

Version

26.7.0.dev0

Lingua principale
Shell
Stelle
9.7k
Fork
2k
Merge medio
3g 2h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/self-hosted

Tutte le issue di getsentry/self-hosted

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.