Problem with locks

I’ve a batch file (windows) that runs once per hour. Two lines, the first is the backup, the 2nd is pruning (through forget). Unfortunately, the 2nd line always fails because there’s a lock from the first that doesn’t get released. I’ve tried adding a third line in between the first two with the unlock command, but it doesn’t make a difference. Any ideas how I can get this to work?

Hm, that’s odd, restic should remove the lock before quitting. What backend do you use? Is maybe a second instance of restic running on the same backend?

Purely a guess, but is it possible that there is a race condition on the backend side wherein the “prune” process attempts to secure a lock before the backend fully releases the “backup” lock? Have you tried the same sequence on the same repo with a delay between the steps?

I know that in some cases (B2 in particular) commits to the backend filesystem are not necessarily instantaneous so I can at least imagine two independent connections to the backend running up against this.

Oh, good point. What backend are you using?

I was searching the forum for this problem and read the suggestion of a race condition. I’m backing up through a cron script using backup/forget/check. The backup is to a seperate partition. After putting sleep 10 between my backup and forget command I didn’t get the lock problem anymore.