Skip to content

PR #304 IPC: daemon restart regresses over UDS on ubuntu CI ("restart within 45s"); passes over TCP on main #310

Description

@StefanSteiner

Symptom

On PR #304 (feat(mcp): connect the daemon to its engine over IPC), two of the three daemon restart tests fail on test (ubuntu-latest):

thread 'engine_recovers_after_hyperd_killed' panicked at hyperdb-mcp/tests/daemon_tests.rs:1744:9:
daemon should restart hyperd within 45s
thread 'hyperd_monitor_detects_killed_hyperd_and_restarts' panicked at hyperdb-mcp/tests/daemon_tests.rs:1647:9:
daemon should restart hyperd within 45s
test result: FAILED. 61 passed; 2 failed

client_report_triggers_restart_after_kill (the third restart test) passes. This is after #309 raised the readiness budget 12 → 45s, so it is not the old budget-too-small timeout — the daemon genuinely does not restart hyperd within 45s over UDS under CI load.

Why this looks like a real UDS regression, not the known flake

The distinguishing evidence: the same two tests pass on main (TCP transport) on ubuntu — confirmed green at 82b45cb (the rc.3 release commit) and on #309's CI run (bea4855, test (ubuntu-latest) passed). They fail only on #304, whose sole functional change is switching the daemon's engine connection from TCP to a Unix domain socket. So the delta is the transport, not test flakiness or CI noise.

They pass 4/4 locally (macOS dev box, the adversarial reviewer's runs, and the fix-worker's runs), so the failure is load/timing/platform-dependent and does not reproduce on a developer machine — which is why it slipped past local gates and the review.

Likely mechanism (from the #304 review's own I-1/I-4 findings)

hyperd refuses to bind an already-occupied domain-socket path and dies ("domain socket is in use"). The restart path works only because try_restart_hyperd drops the old HyperProcess (reaping the SIGKILLed child) before respawning, so hyperd's pid-liveness staleness check on <dir>/hyper.pid lets the replacement rebind the same socket path. Under ubuntu CI load, the reap-then-rebind sequence appears to race — the stale socket/pid state may not clear in time, so the rebind is refused or delayed past 45s and the restart never completes. The fast-fail pre-flight added in the fix cycle only rejects an already-bound socket; it does not fix a slow or racy rebind.

Over TCP (the previous transport) this never happened because each restart bound a fresh ephemeral port, sidestepping the stale-endpoint problem entirely.

Impact

#304 must not merge until this is resolved. It is a reliability regression in the daemon's core value — crash detection and restart — over the new transport. It is not urgent: rc.3 is already shipped, rc.4 is not being cut, and #304 is future work. But it blocks #304, and it is a genuine finding about the IPC design, not a test artifact.

Next steps

  1. Confirm consistency — re-run feat(mcp): connect the daemon to its engine over IPC #304's ubuntu job a few times. A flake would intermittently pass; a real rebind race should fail most runs. (One re-run is in progress as this is filed.)
  2. If consistent, fix the UDS stale-socket rebind on restart: likely try_restart_hyperd (or hyperd startup) should explicitly unlink the stale socket path before rebinding, rather than relying on the pid-staleness check racing the reap under load. This is the same territory as the review's I-1 and the deferred single-instance-lock work.
  3. Reconcile with Decide whether the 8 macOS-skipped daemon-mode tests should be re-enabled (or the guard made explicit) #305 (the macOS-ignored restart tests) and Flaky: scan_all_refused_returns_freeport_base sees another test's fixture discovery record #300 (the shared-state flake) — the restart-test reliability story now spans TCP-flaky-on-macOS and UDS-broken-on-ubuntu.

Provenance

Surfaced when #304 was update-branched onto main (with #309's fixes) and its test (ubuntu-latest) leg failed 2/3 restart tests. Verified the same tests pass on main over TCP. #304 head e51fdefb, run 34092465671.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions