Skip to content

fix(notifications): replace polling with Docker event stream for container lifecycle detection#588

Merged
AnsoCode merged 2 commits into
mainfrom
fix/docker-event-stream-crash-detection
Apr 14, 2026
Merged

fix(notifications): replace polling with Docker event stream for container lifecycle detection#588
AnsoCode merged 2 commits into
mainfrom
fix/docker-event-stream-crash-detection

Conversation

@AnsoCode

Copy link
Copy Markdown
Collaborator

Summary

  • Replace 30-second polled crash detection with a per-node Docker events stream coordinated by a new DockerEventManager singleton
  • Distinguish intentional stops (docker stop, compose down, stack restart/update) from real crashes using causal event classification (kill/oom/die ordering)
  • Detect OOM kills as a distinct alert category; previously invisible behind the exit-code 137 filter
  • Reconcile container state on connect/reconnect via snapshot diffing, with mass-event consolidation on daemon restarts
  • Keep host limits, janitor, version check, and stack metric alerts in MonitorService; crash and healthcheck detection move out entirely

Test plan

  • 834 backend tests pass, including 39 new tests across classifier, event service, and manager
  • tsc --noEmit clean
  • Backend booted successfully with the manager running; /api/health returns 200
  • Docs updated: docs/features/alerts-notifications.mdx now documents real-time crash detection, OOM alerts, daemon interruption handling, and the Global Crash Detection toggle

…ainer lifecycle detection

Replaces the 30-second MonitorService crash-detection poll with a causal,
per-node Docker events stream. Eliminates false crash alerts on intentional
stops (docker stop, compose down, stack restart/update), detects OOM kills
as a distinct alert category, and surfaces real crashes in real time.

A new DockerEventManager spawns one DockerEventService per local node. Each
service consumes the filtered container event stream, classifies die events
against recent kill/oom state, and reconciles container state via snapshot
diffing on connect and reconnect. Rate limiting, exponential backoff with
jitter, and parse-error tolerance keep the stream resilient under load and
during daemon interruptions.

MonitorService retains host limits, janitor, version check, and stack metric
alerts; crash and healthcheck detection move out entirely.
@AnsoCode
AnsoCode merged commit ad9a685 into main Apr 14, 2026
6 checks passed
@AnsoCode
AnsoCode deleted the fix/docker-event-stream-crash-detection branch April 14, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant