borg-backup-ui
borg-backup-ui copied to clipboard
Prevent concurrent Docker backup recovery state races
Summary
Concurrent Docker-enabled backup jobs can race while writing the shared runtime recovery state. One observed job stopped Docker containers and then failed while replacing runtime-recovery.json.tmp with runtime-recovery.json.
Observed behavior
Two Docker-enabled jobs, appdata and testdaten, were started close together. The second job stopped Docker containers and then failed with:
No such file or directory: `/boot/config/borg-backup/config/runtime-recovery.json.tmp` -> `/boot/config/borg-backup/config/runtime-recovery.json`
System Health then showed a pending Docker restart recovery warning for the affected job.
Expected behavior
- Only one Docker-control backup job should control Docker at a time.
- Runtime recovery state updates must be concurrency-safe even if two processes reach the recovery writer.
- A skipped job because of resource locks must not stop containers first.
Scope
- Make runtime recovery read-modify-write operations safe across processes.
- Add tests covering concurrent runtime recovery writes.
- Check Docker resource lock acquisition order and add focused regression coverage if needed.
User impact
Prevents failed backup jobs and stale Docker/VM restart recovery warnings when Docker-enabled jobs overlap.