Skip to content

soft: evict a non-regular lock file without reading it#597

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
dxbjavid:soft-lock-nonregular-read
Jul 13, 2026
Merged

soft: evict a non-regular lock file without reading it#597
gaborbernat merged 1 commit into
tox-dev:mainfrom
dxbjavid:soft-lock-nonregular-read

Conversation

@dxbjavid

Copy link
Copy Markdown
Contributor

_read_lock_file reads the soft lock file straight after opening it, without first checking it is a regular file. A same-uid peer can plant a fifo at the lock path with a writer attached, so the non-blocking read raises EAGAIN, which stale detection's suppress() quietly swallows; the file is then never broken and acquire just wedges until timeout (an empty non-blocking fifo read also raises EAGAIN on FreeBSD even without a writer). This mirrors the guard added to the soft read/write marker in #588: fstat first, and when the path is not a regular file report it as a malformed lock with its mtime and inode so the usual age-based eviction clears it rather than reading from it.

@gaborbernat gaborbernat force-pushed the soft-lock-nonregular-read branch from 0a1f282 to 946fd37 Compare July 13, 2026 04:15
@gaborbernat gaborbernat merged commit 36eded2 into tox-dev:main Jul 13, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants