Skip to content

fix: every stop followed by a start holds the daemon, not only a restart - #491

Merged
7schmiede merged 2 commits into
mainfrom
fix/idle-across-every-switch
Nov 9, 2026
Merged

7schmiede merged 2 commits into
mainfrom
fix/idle-across-every-switch

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

an_edit_while_exited_follows_the_restart failed on Windows CI twice (in #485 and #486, whose diffs touch only ci.yml and Cargo.lock). The daemon log shows a real bug, not a flaky test: a candidate of a service without a proxy took over by a stop and a start; 9 ms after the stop the idle check found nothing running (daemon_idle_end, "nothing runs in it any more"), and the start ran in a daemon on its way out. The test's next request was refused.

Cause The idle check (ADR-0095) counts a restart under way as running since #481, but only restart() registered itself; a candidate taking over in place (take_over, from the watcher, with no request holding the daemon), relaunch and the hot-reload switch stop and start without it.
Bug class race-on-idle (sibling of #481)
Proof The CI log of #485 (daemon_idle_end between the candidate's stop and start). Unit test a_switch_under_way_counts_as_running for the guard (nested, dropped); locally on Windows an_edit_while_exited_follows_the_restart, restart_on_a_folder_…, a_failed_first_start_… green. The race itself is not reproducible on demand (a 1 s tick against a gap of milliseconds).
Siblings All stop + start pairs in the daemon: restart (guarded), take-over, relaunch, hot reload: now one guard, switching. A lane's reset and a group's start/stop come as requests, which hold the daemon already.
Guard Supervisor::switching, an RAII guard: one place every stop-then-start goes through.

No review card: a fix within ADR-0095's rule.

🤖 Generated with Claude Code

7schmiede and others added 2 commits November 9, 2026 15:33
A candidate of a service without a proxy takes over by a stop and a start
(`take_over`), from the watcher, with no request holding the daemon: when
the idle check ran in the gap, the daemon ended and the start ran in a
daemon on its way out (`an_edit_while_exited_follows_the_restart`, Windows
CI, twice). #481 guarded `restart` alone; `switching` is now the one
guard, used by restart, take-over, relaunch and the hot-reload switch.

Bug-Class: race-on-idle
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede force-pushed the fix/idle-across-every-switch branch from fb38e9b to 5f2fbcd Compare November 9, 2026 14:33
@7schmiede
7schmiede merged commit e8bdd9c into main Nov 9, 2026
@7schmiede
7schmiede deleted the fix/idle-across-every-switch branch November 9, 2026 14:48
@7schmiede 7schmiede mentioned this pull request Nov 9, 2026
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