node-services and teamhub keep running and flood 500/ECONNREFUSED errors after PostgreSQL exits

Aperta
#864 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, typescript
Ambito
backend, databases

Direzione di ricerca

Start by tracing how the desktop supervisor shuts down PostgreSQL and how node-services and teamhub handle database or backend failures; the issue names no source files or tests. Inspect the task-worker, agent-memory, run-wake, and voice pollers for retry behavior. Done means dependent services stop or pause when PostgreSQL exits, and repeated failures back off without flooding logs.

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

Descrizione

Summary

When bundled PostgreSQL (and LiveKit) shut down cleanly on desktop exit/restart ([linger-supervisor] postgres exited code=0 ... reason=not_supervised), node-services and teamhub remained running for ~20 minutes (14:50:45 to 15:11:15) and continuously polled PostgreSQL (127.0.0.1:63743) / TeamHub without shutting down or backing off, producing 2,318 task_worker.drive_failed (HTTP 500) warnings and dozens of memory/voice/wake errors.

Environment
  • Linger Desktop: 0.1.10 (source-native mode)
  • OS: macOS (Darwin 27.2.0 arm64)
  • Bundled PostgreSQL: 17.10 (pgvector 0.8.6)
Observed Timeline & Redacted Logs
  1. 14:50:45 (+08:00) — PostgreSQL and LiveKit received shutdown signals and exited cleanly:
# postgres.log
2026-11-27 14:50:45.261 +08 [51245] LOG:  received smart shutdown request
2026-11-27 14:50:45.263 +08 [51399] FATAL:  terminating connection due to administrator command
...
2026-11-27 14:50:45.288 +08 [51245] LOG:  database system is shut down
[linger-supervisor] postgres exited code=0 signal=null uptime_ms=3181033 restart=no reason=not_supervised

# livekit.log
2026-11-27T14:50:45.266+0800	INFO	livekit	server/main.go:315	exit requested, shutting down	{"signal": "terminated", "force": false}
[linger-supervisor] livekit exited code=0 signal=null uptime_ms=3180148 restart=no reason=not_supervised
  1. 14:51:00 – 15:11:14 (+08:00) — node-services and teamhub stayed alive and continuously errored until PostgreSQL was started again at 15:11:14:
# node-services.log
14:51:00.060 WARN  [agent-memory] agent_memory.reconcile_failed
  error={"name":"NonErrorThrown","reason":"TeamHubRuntimeStateError: TeamHub Runtime State returned HTTP 500: Agent Runtime State request could not be completed"}
{"time":"2026-11-27T06:51:00.079Z","level":"warn","service":"node-services","event":"voice.reconcile_failed","role":"voice","reason":"teamhub_status","status":500}
{"time":"2026-11-27T06:51:01.086Z","level":"error","service":"node-services","event":"memory.report_reconciliation_failed","role":"memory","error":{"name":"Error","message":"connect ECONNREFUSED 127.0.0.1:63743","code":"ECONNREFUSED"}}
{"time":"2026-11-27T06:51:01.087Z","level":"error","service":"node-services","event":"memory_periodic_work_failed","role":"memory","work":"session_triggers"}
14:51:12.199 WARN  [run-wake] run_wake.scan_failed
  error={"name":"TeamHubRuntimeStateError","reason":"TeamHub Runtime State returned HTTP 500: Agent Runtime State request could not be completed"}
14:51:44.148 WARN  [task-worker] task_worker.drive_failed
  error={"name":"TeamHubTaskWorkerError","reason":"TeamHub Task Worker request returned HTTP 500: {\"error\":{\"code\":\"INTERNAL_ERROR\",\"message\":\"an unexpected error occurred\",\"request_id\":\"<redacted>\"}}"}

Error volume during that 20-minute window:

  • task_worker.drive_failed (HTTP 500): 2,318 occurrences
  • agent_memory.reconcile_failed (HTTP 500): 41 occurrences
  • run_wake.scan_failed (HTTP 500): 28 occurrences
  • memory_periodic_work_failed / memory.report_reconciliation_failed (ECONNREFUSED 127.0.0.1:63743): 22 / 21 occurrences
  • voice.reconcile_failed (HTTP 500): 21 occurrences
  • wiki_calendar_checkpoint_failed / memory_schedule_run (ECONNREFUSED): 5 / 4 occurrences
  1. 15:11:14 (+08:00) — PostgreSQL and LiveKit started again when Linger was relaunched, after which errors stopped.
Expected Behavior
  1. Dependency-ordered shutdown: Stop dependent services (web, node-services, teamhub) before shutting down postgres, and if postgres exits, cascade-stop or pause dependent services rather than leaving them orphaned.
  2. Exponential backoff on persistent backend/DB failures: Background pollers (task-worker, agent-memory, run-wake, voice) should back off when hitting repeated ECONNREFUSED or HTTP 500 errors to avoid CPU spin and log truncation (both node-services.log and teamhub.log hit their 8 MB cap).
Lingua principale
TypeScript
Stelle
3.8k
Fork
360
Merge medio
8h 10m
PR unite (30g)
540

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 simplexai-labs/linger

Tutte le issue di simplexai-labs/linger

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.