You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lockfile: CleanupAll/CleanupStaleLocks still unlock before unlink #6713
AcquireTrackedLock/ReleaseTrackedLock in pkg/lockfile/cleanup.go were fixed to close the unlock/unlink release race (unlink before unlock, plus an inode-identity check on acquire) for the normal WithFileLock path.
CleanupAll (process-exit cleanup) and CleanupStaleLocks (startup stale-lock sweep, which includes the secrets-store directory) still do unlock-then-remove, and don't go through AcquireTrackedLock's identity check. Per jaormx: "A waiter can acquire and pass the inode check between those steps, then have its lock pathname removed while another process locks a replacement inode... this isn't just an unused helper."
Scope: reorder both to unlink-before-unlock, and decide whether they should route through AcquireTrackedLock for the identity check where applicable (CleanupStaleLocks uses TryLock on an already-stale-by-age file, so the tradeoffs may differ from the normal acquire path).
I'd like to take this one. The fix is straightforward: change CleanupAll and CleanupStaleLocks to unlink (os.Remove) before unlocking, matching the race-safe order in ReleaseTrackedLock's comment (flock locks inodes, not paths). Happy to have it assigned.
Updated PR #6794 with unlink-before-unlock for CleanupAll and CleanupStaleLocks in pkg/lockfile/cleanup.go (matches ReleaseTrackedLock order). Tests pass and build is clean.
Activity
suantea commentedon Oct 10, 2026
I'd like to take this one. The fix is straightforward: change CleanupAll and CleanupStaleLocks to unlink (os.Remove) before unlocking, matching the race-safe order in ReleaseTrackedLock's comment (flock locks inodes, not paths). Happy to have it assigned.
fix: unlink before unlock in lockfile cleanup paths
suantea commentedon Oct 11, 2026
Updated PR #6794 with unlink-before-unlock for CleanupAll and CleanupStaleLocks in pkg/lockfile/cleanup.go (matches ReleaseTrackedLock order). Tests pass and build is clean.
suantea commentedon Oct 11, 2026
Follow-up in PR #6794 updates the unlink-before-unlock ordering in CleanupAll and CleanupStaleLocks.