Skip to content

fix: a restart under way keeps the daemon - #481

Merged
7schmiede merged 1 commit into
mainfrom
fix/idle-during-restart
Nov 6, 2026
Merged

7schmiede merged 1 commit into
mainfrom
fix/idle-during-restart

Conversation

@7schmiede

Copy link
Copy Markdown
Member

What and why

Since 0.41.0 the daemon ends with the last tree (ADR-0095): once a second passes with nothing running and no request holding it, it ends. A restart (restart_on, devstack restart, a rebuild, a hot-reload restart, a dependent's restart) stops the service before it starts it again; in that gap nothing runs. On Windows the stop takes seconds, and the daemon ended in it:

15:52:09.760 service dev: stopped        (a restart_on restart)
15:52:09.879 daemon_idle_end "nothing runs in it any more"
15:52:09.943 service dev: starting       (in a daemon on its way out)

That is the "connection refused" the Windows integration jobs showed now and then today (#470, #478, the release pull request #480, and main after #472 and #469), in whichever test restarted a service. A user sees it as a dashboard and CLI that find no daemon after a restart, until the next up.

Supervisor::runs_anything now counts a restart under way (restarts_under_way, which restart already kept) as running.

Checked

  • New unit test a_restart_under_way_counts_as_running: red without the fix, green with it
  • Windows 11, locally: restart_on_a_folder_restarts_for_each_file_in_it and an_edit_while_exited_follows_the_restart green
  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test -p devstack-daemon

Siblings looked at: a lane's restart is covered already (lanes.restarting()); hot reload, restart_running and a dependent's restart go through restart. Not covered: a Compose container's docker restart, if it were the only thing running.

🤖 Generated with Claude Code

Since the daemon ends with the last tree (ADR-0095), the idle check could
fall into a restart's gap: the service stopped, not yet started, nothing
else running. On Windows the stop takes seconds, so the daemon ended there
and its integration tests failed now and then with "connection refused".
A restart under way now counts as running.

Bug-Class: a state between two steps of one operation read as the end state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit cb95bc0 into main Nov 6, 2026
@7schmiede
7schmiede deleted the fix/idle-during-restart branch November 6, 2026 16:07
7schmiede added a commit that referenced this pull request Nov 9, 2026
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>
7schmiede added a commit that referenced this pull request Nov 9, 2026
…art (#491)

* fix: every stop followed by a start holds the daemon, not only a restart

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>

* docs: one Fixed section

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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