On restart, NewSnapshotter completes all recovery work before Serve() creates the unix socket: per-daemon GetState, restarting dead daemons (including remounting their RAFS instances), the hot-upgrade check, and the initial credential reconciliation (#790 moves that one off the startup path). Recovery time scales with the daemons/mounts/snapshots accumulated on the node, and nothing prunes those, so on a long-lived node a restart can leave the socket missing for minutes — containerd gets Unavailable for every snapshot RPC and all new container creation on the node fails until recovery finishes. systemd reports the unit active the whole time (Type=simple), so nothing signals the window. A crash during recovery re-enters it every RestartSec.
Two design questions before proposing anything concrete:
- Is serve-after-full-recovery an invariant you want to keep (correctness of snapshot ops against half-recovered state), or would you consider serving earlier and recovering daemons in the background?
- If the ordering must stay: would you take (a) an opt-in readiness signal (
sd_notify + Type=notify) so operators can gate on and observe the recovery window, and/or (b) parallelizing the per-daemon recovery walk so the window is bounded by the slowest daemon instead of the sum?
Happy to send PRs for whichever direction you prefer.
On restart,
NewSnapshottercompletes all recovery work beforeServe()creates the unix socket: per-daemonGetState, restarting dead daemons (including remounting their RAFS instances), the hot-upgrade check, and the initial credential reconciliation (#790 moves that one off the startup path). Recovery time scales with the daemons/mounts/snapshots accumulated on the node, and nothing prunes those, so on a long-lived node a restart can leave the socket missing for minutes — containerd getsUnavailablefor every snapshot RPC and all new container creation on the node fails until recovery finishes. systemd reports the unitactivethe whole time (Type=simple), so nothing signals the window. A crash during recovery re-enters it everyRestartSec.Two design questions before proposing anything concrete:
sd_notify+Type=notify) so operators can gate on and observe the recovery window, and/or (b) parallelizing the per-daemon recovery walk so the window is bounded by the slowest daemon instead of the sum?Happy to send PRs for whichever direction you prefer.