Files
felhom.eu/documentation/audits/dataloss-hunt-2026-10-20/C1-time-concurrency-candidates.md
T

6.7 KiB
Raw Blame History

C1 reviewer 4 — time and concurrency (fresh, read-only; controller 7ca59e2, agent 4e1621c, felhom.eu 5c48731)

(A) Schedulers and what each does on Sunday 2026-10-25 (03:00 CEST → 02:00 CET; 02:00–02:59 happens twice)

owner job schedule zone file:line 2026-10-25 after 3 days off
controller db-dump daily W (default 02:30) Budapest (time.Date, day+1) main.go:1262, scheduler.go:499-518 once, at the SECOND 02:30 (CET = 01:30Z) — Go normalises the ambiguous time to the later offset not replayed by the scheduler; the catch-up runs it once 15 min after start (nightchain.go:277-345)
controller tier2-backup W+60m Budapest main.go:1352 once, 03:30 CET once, by the catch-up
controller offbox-backup + app-update leg W+105m Budapest main.go:1519 once, 04:15 CET catch-up runs the off-site leg only
controller offsite-abandon-sweep 05:10, offsite-proof 05:30, offsite-integrity 06:00 fixed Budapest main.go:1561, 1613, 1591 once no catch-up (finding T6)
controller metrics-prune 04:00, fill-watch 03:30, asset-sync 05:00, selfupdate-auto 04:30 (off by default) fixed Budapest main.go:1621,1671,1768,1741 once floor update runs on any hub reply
controller whole-guest quiesce loop poll 5 min; gate [W+2h, W+6h) by wall minute; valve when age > cadence+24h Budapest wall quiesce.go:150, 191-205, 790-818 gate 04:30–08:30 CET (4 h real) valve fires ~5 min after start, any time of day
controller ~20 Every tickers monotonic n/a main.go:898-2146 unaffected restart at boot
agent whole-guest due age ≥ cadence UTC localapi/server.go:1182-1192 unaffected due at once
agent restore-test 30 min after start, then 6 h UTC backup/schedule.go:148-177 unaffected after 30 min
agent OS leg (+ kernel reboot if hub „Tonight") after any non-manual primary backup +90 s, 20 h min gap no wall clock server.go:982-986, main.go:1272-1280, leg.go:655-664, kernel.go:101-114 follows the backup follows the valve backup = daytime (T8)
agent fstrim hourly; due Wed 10:00, only 10:00–20:59 host local fstrim/fstrim.go:39-50,110 n/a next eligible hour
hub scheduleDaily: db-snapshot 02:00 (keep 2), prune 04:30, deadline-check 05:00, offsite-key-audit 07:10 next.Add(24*time.Hour) Budapest hub cmd/hub/main.go:1049-1072 every job runs TWICE (T9) n/a
host timers mgmt-watchdog, crash-guard-check monotonic n/a felhom-agent/configs/*.timer unaffected after boot
DooPlex timers hub-db-backup 02:30; dooplex-offsite 00:20; hub-db-restore-test Sun 04:30; offsite-restore-test Sun 05:30; ep0-copy-gc 08:00 OnCalendar local DooPlex felhom.eu/scripts//.timer Oct 25 is a Sunday: both weekly restore tests run on the DST day; 02:30 is in the repeated hour (systemd behaviour not verified) Persistent=true

(B) Candidates

# Sev guess harm mechanism
T1 P2 med-high The nightly second-drive mirror (rsync --delete) can run DURING a restore from that same mirror and delete the files not yet copied back tier2.go:479-520 RunAllTier2 checks held/version/disconnected only; :443 mirror, :744-751 --delete; restore tier2_whole.go:301 takes only acquireRunning; Tier-2 leg takes only LegLock (main.go:1348-1352); update_guard.go:595-601 isHeld ignores restores
T2 P2 if true; low-med The Debian 13 controller image may lack tzdata → every schedule on UTC silently Dockerfile:77-100 debian:13.7-slim, no tzdata, no time/tzdata import; fallbacks scheduler.go:19-23 (logs), quiesce.go:749-751 (silent), funcmap.go:62-66
T3 P3 med Whole-guest start creeps ~5 min/night until a night is skipped silently agent server.go:1184 age >= Cadence no slack; age from archive start; controller poll 5 min quiesce.go:150; gate refusal :807-818
T4 P3 med-high The whole-guest quiesce stops apps in the middle of a restore or an update quiesce.go:213-275 no IsRunning()/restore check; RunningAppStacks (stacks/manager.go:620-636); TriggerNow (:419-445) same; DumpAppVolumesSafe (backup.go:1001-1045) can restart an app quiesce stopped
T5 P3 high The nightly off-site copy is skipped SILENTLY when anything else holds the backup flag, and the catch-up never retries offbox.go:981-996 INFO „skipped — another backup is running" return nil; withLeg MarkEnded unconditionally (main.go:1246); proof 05:30 / integrity 06:00 take the same flag
T6 P3 high Off-site check and proof never run on a box off at 05:30–06:00; the code comment says the opposite main.go:1575-1577 comment vs 1591-1619; catchUpLegs nightchain.go:17-18; no hub alarm on integrity/proof age
T7 P3 high Hub raises a false „no DB dump" error every morning for W after ~04:45 or evening W hub monitor/deadline.go:416-419 midnight Budapest; :556-565 → expected_dbdump_missed; hub has no idea of W
T8 P3 design The OS leg and kernel reboot follow ANY scheduled backup, including the daytime valve after power-on agent server.go:982-986; main.go:1279 labels „night"; kernel.go:101-114; hub osupdates/kernel.go:46-48,181-185
T9 P4 high Hub daily jobs run TWICE on 25 October (db-snapshot keep-2 prunes a day early; duplicate deadline alarms); once an hour late in spring hub cmd/hub/main.go:1058-1062 next.Add(24*time.Hour); the controller fixed this (scheduler.go:511-516)
T10 P4 high Spring forward 2027-03-28: db-dump and tier2 fire at the same instant; tier2 may mirror yesterday's unit scheduler normalisation; LegLock main.go:1237 plain mutex
T11 P4 design A clock ahead stops whole-guest backups silently (same as D3) server.go:1182-1192; quiesce.go:816-817; deadline.go:244; backup_cap.go:61
T12 P4 high self-update busy check before the image pull, swap after it with no re-check updater.go:532-545, :764
T13 P4 med double-clicking a restore shows it as failed while it runs handlers.go:1853, :1874 BeginRestoreOp after the check; second POST's EndRestoreOp(false)

Checked SAFE (reviewer): controller DST day+1 arithmetic and late-fire skip (scheduler.go:342-348, 511-516); night ledger persisted, seeded, one catch-up for many nights; quiesce marker persisted and recovered; in-memory backup flag (no stale lock); flock-based OS-leg locks; restic stale locks self-heal; two restores blocked by m.running; Remove refused during restore/quiesce; catch-up and whole-guest wait for each other; agent due/cap UTC durations; off-site prune guard refuses future snapshots; host power-off re-checks; no cron/OnCalendar in the installer; hub staleness uses the hub's own receive clock.