Repository navigation
fix(pc-install): the restore stops a server it started beside one registered meanwhile, and none of it outlives shutdown - #4959
Conversation
…istered meanwhile, and none of it outlives shutdown With the restore on (experimental), a replacement that registers on the socket on another port while the stopped server is started again was not seen: the launcher probes only the old port, so the restored server ran unregistered beside it and the job waited out startMs to say it did not start. The wait now stops the very process it started (its pid and birth) once any registration not seen before the launch appears, and says another already runs in its place. PcInstaller.stop() now closes the restore's own SSH connections, which no job holds, and a start that fails once this app stopped is not retried, so the restore neither opens a second connection nor keeps polling a PC through the app's teardown. Refs #3385
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Merged through
Reviews: omo gate (CLEAR) + omo-native-code-reviewer (CLEAR; Codex via axwith timed out twice before a verdict). CodeRabbit did not review this head. Lane oi-core-terminal, per the lead's brief. |
Two remaining races in the experimental restore of a replaced server (Settings -> Experimental -> PCs, off by default), from the reviews recorded on #3385. The PID-only holder check the issue opened with was already fixed by #3403.
A replacement that registers on another port while the restore runs
The restore's launcher probes only the stopped server's own port. A replacement that came up on another port meanwhile was not seen, so the old server was started beside it. The socket keeps one registration, so the restored server served unregistered beside the replacement, and the job waited out its 3-minute start wait to say it did not start (or, where both registered, said it was restored).
The wait after the launch now looks at every registration on the socket. Once a token not seen before the launch appears, held by another process, it stops the very process it started (its pid and its launch birth) and reports that another already runs in its place.
Shutdown during the restore
The restore's own SSH connection is held by no job, so
PcInstaller.stop()could not close it. A first connection still starting when the app stopped was retried, and a restore already waiting kept polling the PC through the teardown.stop()now closes those connections, and a failed start is not retried once the app is stopping.No UI, setting or HTTP/WS contract change.
Tests
otherRegistersOnRestorecase of an existing test is this same race, and now expects "another already runs in its place".bun run check fastpasses.Still open on #3385, all failing safe (no second server is started): a no-birth registration at a reused PID reads as a server (the restore is skipped with a slightly wrong message); the stop wait knows the original by PID and command shape; and the LOW clock-jump case for 0.5.x registrations.
Refs #3385