Skip to content

🐛 fix(lease): report lost claims through release - #1069

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:fix/soft-lease-hardlink-g4k
Nov 21, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:fix/soft-lease-hardlink-g4k

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

A hard link can keep a lease's old marker alive after its public name disappears. The previous heartbeat treated any surviving link as evidence that the marker remained. The heartbeat now checks the marker's parent path. If the directory still exists at that path and the marker is gone, the heartbeat reports the lost claim through on_compromise (#1013).

On POSIX, release checks for claim loss before closing the descriptor. If a peer took the claim between heartbeats, callers can read compromise after the protected work ends (#1026). Only the heartbeat invokes the callback. A rename still in progress can roll back, so release records a loss only when it can confirm that the old marker is gone or replaced.

Two consecutive missing-marker checks trigger marker-missing. A missing parent permits refresh because the marker may have moved with it. Persistent parent lookup errors can produce refresh-failed, including when a Windows junction is removed.

The November 2026 filelock review reported ANT-2026-G4KJZN91 and ANT-2026-TWBZ8VR8.

Fixes #1013, fixes #1026.

@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 15:32
@gaborbernat gaborbernat changed the title 🐛 fix(lease): detect hard-linked marker loss 🐛 fix(lease): report lost claims through release Nov 20, 2026
@gaborbernat
gaborbernat changed the base branch from main to reimplement/a2 November 20, 2026 15:42
@gaborbernat
gaborbernat force-pushed the fix/soft-lease-hardlink-g4k branch from f205963 to 832a3ab Compare November 20, 2026 15:42
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 17:33
@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 19:33
@gaborbernat
gaborbernat force-pushed the fix/soft-lease-hardlink-g4k branch from 832a3ab to e2b0475 Compare November 20, 2026 19:52
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 21:35
@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 22:00
@gaborbernat
gaborbernat deleted the branch tox-dev:reimplement/a2 November 20, 2026 23:56
A surviving hard link kept the old lease inode alive after the lock path
disappeared, masking claim loss. Distinguish that case from a moved parent
directory before treating an unnamed marker as still live.

Fixes tox-dev#1013
The heartbeat treats its first marker mismatch as provisional because a
peer's exchange may be rolled back. Release could stop it before a second
check and leave a superseded holder's compromise unset.

Check the held inode before clearing the claim. An unlinked inode proves
the marker change survived the exchange; a linked inode or failed probe
does not.

Fixes tox-dev#1026
@gaborbernat gaborbernat reopened this Nov 20, 2026
@gaborbernat
gaborbernat changed the base branch from reimplement/a2 to main November 20, 2026 23:58
@gaborbernat
gaborbernat force-pushed the fix/soft-lease-hardlink-g4k branch from e2b0475 to be6d538 Compare November 20, 2026 23:58
@gaborbernat
gaborbernat marked this pull request as ready for review November 21, 2026 00:17
@gaborbernat
gaborbernat merged commit 54fe35c into tox-dev:main Nov 21, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SoftFileLease misses a lost claim when release follows a stall A hard link can hide a lost SoftFileLease claim

1 participant