'restic cat' and 'restic snapshots' take a lock of their own, so an exclusive lock left by a dead run blocked the very code trying to clear it — and with --retry-lock it blocked for 30 minutes instead of failing. 'restic list locks' does not lock, which is why the listing worked and the per-lock read hung. Pass --no-lock for cat config, cat lock, list locks and snapshots. Verified against a real orphan: restic check killed with SIGKILL leaves an exclusive lock, ensure_repository no longer blocks on it, and the cleanup removes it.
This commit is contained in:
1 parent
1d8f49980c
commit
58e81b633a
2 files changed
+30
-4
No files matched your search
@@ -69,6 +69,10 @@ record nothing, which is why the query string is the only form used here.
|
||||
| `FAIL_ON_PARTIAL` | `false` | treat restic exit 3 as a failure |
|
||||
| `CRON` | `0 3 * * *` | crond schedule (standard 5-field) |
|
||||
|
||||
`LOCK_STALE_AFTER`, `LOCK_GRACE` and `RETRY_LOCK` are read when the job starts,
|
||||
so changing them needs a container recreate (a Komodo deploy), not just a
|
||||
restart of the job.
|
||||
|
||||
`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` are read by restic itself for the
|
||||
`s3:` backend.
|
||||
|
||||
@@ -96,6 +100,11 @@ ones past restic's own 30 minute window. Every lock is logged with its age,
|
||||
host, pid and verdict, and the ids that were removed are re-checked with a
|
||||
second `list locks` before being reported.
|
||||
|
||||
Reading the locks has to happen with `--no-lock`: `restic cat` and
|
||||
`restic snapshots` take a lock of their own, so an exclusive lock left by a
|
||||
dead run would block the very code that is trying to clear it. `restic list
|
||||
locks` does not lock, which is why the listing works either way.
|
||||
|
||||
The `orphaned` check compares the lock's `hostname` with the container's own, so
|
||||
the compose file pins `hostname: seafile-backup` — without it the hostname is
|
||||
the container id and changes on every recreate, which is exactly the case this
|
||||
@@ -106,6 +115,12 @@ window rather than one that is removed while still in use.
|
||||
`RETRY_LOCK` is the backstop: every restic call carries `--retry-lock`, so a
|
||||
lock that survives the cleanup makes the run wait instead of failing.
|
||||
|
||||
Verified against a real orphan: `restic check` killed with `SIGKILL` mid-run
|
||||
leaves an exclusive lock, and the next cleanup removes it (`orphaned`, age 13s,
|
||||
`unlock --remove-all`, `successfully removed 1 locks`). With the default
|
||||
`LOCK_GRACE` the same lock is reported `live` and left alone until it is ten
|
||||
minutes old.
|
||||
|
||||
## Restore
|
||||
|
||||
```sh
|
||||
|
||||
Reference in new issue
Block a user