Skip to content

🐛 fix(soft): ignore a restore claim with an invalid pid - #871

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
dxbjavid:soft-restore-claim-pid
Oct 28, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
dxbjavid:soft-restore-claim-pid

Conversation

@dxbjavid

@dxbjavid dxbjavid commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

A peer that can write to a lock's directory could plant a file named like a stale-recovery claim, <lock>.restore.<pid>.<token>, beside a dead holder's SoftFileLock, MarkerSoftFileLock or SoftFileLease marker. The recovery step added in #843 read that pid with a \d+ match and probed it unchecked. An oversized number made acquire() raise OverflowError out of os.kill; 0 probed the caller's whole process group, read as alive, and kept the dead holder's lock from ever being reclaimed; and a contender adopted a fullwidth spelling of its own pid as its own claim and exchanged that file's content onto the lock path.

The recovery scan now accepts only ASCII digits and ignores a claim whose pid falls outside 1..2**31-1, the range every other holder parser in the package already enforces. No filelock writes such a claim, so the scan loses nothing legitimate and moves on to the stranded markers it came for.

dxbjavid and others added 2 commits October 21, 2026 13:47
The new test spelled the planted claim's name inline while its siblings
build it with _restore_name, so the two spellings could drift apart.
Widen the helper to take the pid as text and use it here too.
@gaborbernat gaborbernat changed the title fix(soft): bound the pid in a stranded restore claim's name 🐛 fix(soft): ignore a restore claim with an invalid pid Oct 28, 2026
@gaborbernat gaborbernat reopened this Oct 28, 2026
@gaborbernat
gaborbernat merged commit 5bfde28 into tox-dev:main Oct 28, 2026
73 of 102 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.

2 participants