[Bug]: Health watch pages "can't reach Docker" then "answering again after 0s" on one slow probe
Problem description
services:health-watch sends a false outage pair for a server whose Docker daemon is fine.
One missed docker ps hits the 90s group deadline and opens a server-scoped server_unreachable incident:
Can't reach Docker on server "…": no answer from the docker daemon within 90s. N project(s) on this box can't be monitored until it answers.
The sweep already queued behind that deadline then gets a fresh connection and answers immediately, so the incident closes a few hundred milliseconds later:
Server "…" is answering again after 0s.
The daemon was never down. The pair repeats on a cadence of hours, on both a remote SSH target and the local "This Server" socket. It is one alert per server (that part is right) — the problem is that a single wedged probe is enough to send both edges.
Expected: one slow or half-open probe does not page. Page only when a later sweep also gets no answer, and do not close an incident from a reply that landed after the deadline already wrote the group off.
Steps to reproduce
- Run self-hosted Openship with
services:health-watchenabled (default cron* * * * *). - Have at least one project on a server whose Docker API is reached over SSH, or on the local socket.
- Wait until one
listAllContainerscall stays open for the full group deadline (90s). A half-open SSH bridge or a stuck HTTP call to the daemon is enough; the daemon itself keeps answering other calls. - The health-watch run that started at the top of a minute gives up at
:30and emitsserver.unreachable. - The run already waiting on
sweepChainstarts immediately,listAllContainerssucceeds, andserver.reachablefires with downtime under one second ("after 0s").
On one installation this produced 57 resolved server_unreachable rows for a single remote server and 26 for the local box, over about three weeks. Every recent row opens at the :30 second mark and resolves in roughly 200–700ms. A real outage would stay open.
Environment
- OpenShip version/commit: 0.8.0 (the same pair is in the incident history from earlier 0.7.x builds)
- Deployment method: self-hosted, compose
- Operating system: Linux host, remote servers over SSH
- Browser (if applicable): n/a — notification feed / incident history
Logs and screenshots
Incident shape (times are real, names omitted):
kind: server_unreachable
message: no answer from the docker daemon within 90s
since: 2026-09-28T00:52:30.483Z
resolvedAt: 2026-09-28T00:52:30.846ZSame shape on the control plane's own socket, also opened at :30 and closed about 1s later. Older rows sometimes carried (HTTP code 502) unexpected - Could not reach the Docker daemon and stayed open for about a minute; the current 0s pair is the deadline path in health-watch.ts (GROUP_DEADLINE_MS / GROUP_DEADLINE_REASON).
Additional context
withTimeout races the group read. It cannot cancel it. At 90s the catch records the server unreachable and disposes the transport. The call that was in flight, or the sweep queued behind sweepChain (the next minute's tick, blocked for the whole deadline), then succeeds and resolveServerIncident announces recovery. formatDowntime of a few hundred milliseconds is 0s.
Workload faults already require two agreeing observations (AGREE_TICKS + MIN_CONFIRM_GAP_MS). A server miss does not, so the first deadline pages and the immediate success clears it.
The change that stops the pair:
- Count consecutive server misses the same way as workload faults. Open
server_unreachableonly on the second miss outside the confirm gap. An already-open incident still dedups. - If the container list returns after the group was marked abandoned, return without forgiving the miss or resolving the incident. That late success is what mails "answering again after 0s".
A box that is actually silent on two sweeps still pages once, for the server, and a later successful sweep still sends the all-clear with a real duration.
Source: oblien/openship