From f02b09eae7e806f2fe9caa26b4975b94351d7e27 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 01:26:11 +0000 Subject: populate: fail when losing the lock, keepalives for the ssh connection The command holding the lock can end while populate runs: killed on the target, e.g. by the OOM killer, or with the shared ssh connection, e.g. when its master gets killed, after which populate's next command would start a new one, and go on without the lock. When that command ends, so does what populate runs it with, ssh or sh, which populate's child is. So Context::shell, which every command on the target goes through, before what it changes, and before the record, checks that the child is still running, failing otherwise. A run that wasn't locked throughout doesn't get recorded, and its journal stays, so the next record tells what it changed. Context keeps the lock, which clean_up releases. The keepalives end the shared connection, and with it the command holding the lock on the target, about a minute after the target stops answering, e.g. when the network fails, instead of when TCP gives up, which may take hours. lock-lost kills the command holding the lock from a pipe source. --- pkgs/populate/README.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkgs/populate/README.md') diff --git a/pkgs/populate/README.md b/pkgs/populate/README.md index 8e3232d..b53fb07 100644 --- a/pkgs/populate/README.md +++ b/pkgs/populate/README.md @@ -256,6 +256,12 @@ the record of the run, which a systemd path unit can watch, e.g.: `flake-input` sources whose copy got patched or got its lock file rewritten, and `target` for `symlink` sources. +The lock ends with the command holding it, which ends with populate, or +with the ssh connection, which keepalives end a minute after the target +stops answering. If it ends while populate runs, e.g. killed on the +target, populate fails before its next command on the target, so a run that +wasn't locked throughout doesn't get recorded. + Until a run finishes, populate keeps a journal in `.populate/journal` of what it began changing, and what that changed, which the next run that finishes sums up in its record. A `file` or `git` source whose lock file -- cgit v1.3.1