Repository navigation
golive: keep the home owned after a W1 or switch that stops T3 ends (#530) - #556
Conversation
Review (lens A)Verdict: one BLOCKING finding. The fix leaves #530's own case open for a W1 whose Checked: the full diff (handoff, coldcopy, back, switch, check, journal), the BLOCKING
MAJOR
MINOR
State question:
|
Review (lens B)Head BLOCKING1. A W1 whose MAJOR2. With
MINOR
State question, the rest checked and fine: a SIGKILL anywhere after Verdict: NOT SAFE until 1 is fixed (2 should go with it). |
…cks is blind (#530) Lens round on #556: - The handover keeps the holder for every outcome but the launcher's claim while the service is not active: a `t3 update` that exits non-zero or times out, and a target that never comes up, no longer free the home. - hold_home starts no holder when /proc/locks cannot be read (it could never be found, adopted or stopped); the run holds the home itself and journals why. status and check name an active holder unit they cannot see there. - A reboot ending the holder is a known gap, documented; status now says the home is free then. - The switch guard's fail-open start leaves a disabled T3 (its W1 holds it) stopped and held. - holder_said: do not start T3 by hand while it holds. - #554's look-order test stamps the claim before BEGIN EXCLUSIVE (no GIL race); `looked` is set before the watcher starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5c7cde0 to
1703f80
Compare
…530) A W1 (and a switch) may fail or be killed with T3 stopped on purpose (the home may be half-restored). The owner lock it took after the stop was held by the run's own process, so it was gone with the run: the next SSH launch of the desktop app found the home free and started its own server on it. Right after the stop the kit now starts a holder, a transient unit of its own (t3-golive-hold-<hash of the home>, running `t3-golive hold --home <home>`), that takes the owner lock and keeps it until stopped; the run adopts it as its lock. Every start the kit makes goes through the handover, so the new launcher gets the home from the holder. A failure before the start, a failed start or a kill leaves the holder holding. The same back's rerun takes it over (no free moment, one unit name per home); a resumed verify lets a leftover holder go once the service runs T3; status and check name it; settle stops it; a reboot ends it. It is found by its live process in /proc/locks, never by a file. Where no transient unit starts, the run holds the lock itself, as before, and says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks is blind (#530) Lens round on #556: - The handover keeps the holder for every outcome but the launcher's claim while the service is not active: a `t3 update` that exits non-zero or times out, and a target that never comes up, no longer free the home. - hold_home starts no holder when /proc/locks cannot be read (it could never be found, adopted or stopped); the run holds the home itself and journals why. status and check name an active holder unit they cannot see there. - A reboot ending the holder is a known gap, documented; status now says the home is free then. - The switch guard's fail-open start leaves a disabled T3 (its W1 holds it) stopped and held. - holder_said: do not start T3 by hand while it holds. - #554's look-order test stamps the claim before BEGIN EXCLUSIVE (no GIL race); `looked` is set before the watcher starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1703f80 to
819033c
Compare
Fix roundHead
The rest are listed as follow-ups in the PR body. State question: reruns adopt the holder; there is never a second unit. A run killed half-way leaves the home held. A reboot (old state) leaves no holder and Suites on this head, all OK: gap 46, back 106, check 71, contract 5, copy 108, journal 29, rehearse 87, switch 101. To get the old-code results, I ran the new tests and fixture against this branch's lib from before the fix commit. |
BASE main
Fixes #530
No longer stacked. #554 is merged; this PR now targets
main. It was rebased onto the merged #554, and again ontomainafter main was moved on 11-19. A patch-id comparison shows that only this PR's own commits came over.What
A W1 (and a switch) can end with T3 stopped on purpose, because the home may be half-restored. It does this when it fails after the stop, and also when it is killed. The owner lock it took after the stop belonged to the run's own process, so that lock disappeared with the run. The next SSH launch of the desktop app then found the home free and started its own server on a half-restored home.
t3-golive-hold-<hash of the home>, which runst3-golive hold --home <home>. It takes the owner lock and keeps it until it is stopped. The run adopts it as its own lock. Seecoldcopy.hold_homeandhandoff.serve_holder/Holder.handoff.starting. That includes the update, the switch's put-back, the switch guard's unreadable-journal start, and the copy guard's start. So the new launcher gets the home from the holder, in the same way it got it from the run before. A build that takes no serving lock gets the home just before its start, as before.active(at3 updatethat exits non-zero, or a target that never comes up); the run's own cleanup (Gap.closedetaches the holder and does not kill it); and a SIGKILL. It is let go only to a launcher that took the home, or once the service isactive.backadopts the holder (holderFromin the stop step). There is no free moment in between, and never a second holder, because each home has exactly one unit name.holderLetGo).statusandcheckname the holder and its unit.settlestops it while holding the journal lock, because the owner says the home is right./proc/locks(its exact argv), never by a file, so no stale state can outlive it. After a reboot,statuswarns that the home is free while a run that stopped T3 has not ended ok. The README gives the reasoning./proc/locksunreadable. No holder starts, because the kit could not find it again. The run holds the lock itself and says so (holderError). A holder unit that is active while/proc/lockscannot be read is named by its unit instatusandcheck.holder: null,holderError).Differs from the issue's wording: the issue says the next run should "take the lock, then stop the holder". One exclusive lock cannot be taken while the holder has it, so the next run adopts the holder instead. That has the same effect (no gap) without a free moment.
State question (tests,
gap.test.pyHolder,SwitchHolder)holdunit starts, and the home stays owned while the rerun stops T3 again. The rerun then hands the home to the launcher and ends ok with no holder left. A secondsettlefinds no holder.statusno longer names one, and the rerun takes a new holder. A holder still present at a resumed verify is let go to the running T3. With no transient unit available, the run falls back and says so.status,checkandsettlewere checked end to end. The unit's real command line (bin/t3-golive hold --home ..., with an empty environment and no machine file) was run and stopped with SIGTERM, exit 0.W1Gap's rerun test now drops the holder with a simulated reboot before a hand server can take the home. The switch's and W1's call lists include the holder'srun_detached.Follow-ups (not in this PR)
holderLetGo(lens A 4): restart throughhandoff.startinginstead of only stopping the holder.handoverLateon the first live runs (lens B 4).handoverLatewording (B2).settlecannot stop a holder unit that it cannot see in/proc/locks.statusnamessystemctl --user stop <unit>for that case.General vs project
Everything here is general to the kit: upstream's owner lock (
server-owner.sqlite) and its serving lock, a systemd user transient unit, and/proc/locks. Nothing is specific to one machine or project. The unit name comes from a hash of the home's real path.Old code
main's lib (back, check, coldcopy, handoff, journal, switch)test_a_w1_that_fails_after_its_stop_leaves_the_home_owned('fresh', 'started a hand server, pid …')test_a_killed_w1_leaves_the_home_owned_and_its_rerun_takes_the_holder_over_with_no_gapSwitchHolder(both)home_ownedis False after the killed switchHoldertestsmain)I ran these against
main's lib files with the new tests and fixture. All golive suites pass on this branch: back, check, contract, copy, gap, journal, rehearse and switch.🤖 Generated with Claude Code