fix(continuum): make auto-save die with its psmux server#30
fix(continuum): make auto-save die with its psmux server#30MattKotsenas wants to merge 1 commit into
Conversation
The old loop slept a fixed interval and only noticed the server was gone on its next wake via `psmux ls`, so a kill-server or restart orphaned it until the next tick; its fixed-name mutex then blocked the new server's loop from starting until that orphan was killed. Block on the server instead: one WaitForExit serves as both the save cadence (its timeout) and the death signal (it returns the instant the server exits), so the loop reaps with its server. The single-instance mutex is now keyed to the server pid, so a new server's loop is never blocked by a dying one. Resolve the server via our parent process (run-shell spawns this script as a child of the server), and force the process handle open up front to avoid a pid-reuse race.
|
Hey @MattKotsenas, I've been going through the whole auto save cluster (#24, #26, #28) today and wanted to give this a real review rather than let it sit quiet. I think the design here is genuinely better than what's on main. Keying the loop's lifetime to Where things stand right now: #27 and #28 just merged ( I tried a merge of this branch against current main just now and it conflicts in On the dependency: I checked, Keeping this open for the next iteration of the auto-save loop rather than merging now, both because of the rebase and because I'd like to E2E it (cold-spawn, warm-stay, warm-claim, repeat attach, per your own test plan) once it's on top of #28 and once there's a released core build with #456 in it. Really like where this is headed, thanks for tackling the deeper structural fix instead of just patching around the symptom. |
What
Rewrites psmux-continuum's
auto_save.ps1so the auto-save loop lives and dies with its psmux server instead of outliving it.Why
The old loop slept a fixed interval and only noticed the server was gone on its next wake via
psmux ls, so akill-serveror restart orphaned it until the next tick. Its fixed-name mutex then blocked the new server's loop from starting until that orphan was killed (issue #24 territory).How
WaitForExitdoubles as the save cadence (its timeout) and the death signal (it returns the instant the server exits), so the loop reaps with its server.run-shellspawns this script as a child of the server), with the process handle forced open up front to avoid a pid-reuse race.[TimeSpan] -Interval(e.g.00:15:00).Depends on
Without the psmux-side fix psmux/psmux#456, the hidden
__warm__pre-spawn server also firesclient-attachedand spawns a second auto-save loop (a double-save).Testing
End-to-end against isolated psmux servers (with the #456 binary):
client-attachedon the same server -> mutex keeps a single loop.