Skip to content

🐛 fix(strict): bound claim directory scans - #1040

Merged
gaborbernat merged 10 commits into
tox-dev:mainfrom
gaborbernat:fix/strict-claim-scan-q3-agent
Nov 20, 2026
Merged

gaborbernat merged 10 commits into
tox-dev:mainfrom
gaborbernat:fix/strict-claim-scan-q3-agent

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

A crowded claims directory can keep a nonblocking StrictSoftFileLock acquisition busy reading records. Each acquisition scan now reads at most 1,024 public claims. If it finds more, a nonblocking acquisition raises Timeout and a blocking acquisition retries until its timeout. Operators can still inspect every public claim through the claims property. Draft advisory.

Before publishing, the contender reserves four of the 16,384 directory entries for its intent and held claims, its private record, and a clock probe. If it finds more than 16,380 existing entries, SoftFileLockProtocolError identifies the directory and reports how many hidden entries the scan checked. If the directory grows past 16,384 entries after publication, the contender withdraws its claims and follows the same timeout policy.

In the sentinel directory, cleanup checks up to 1,024 matching private records. Unrelated files in that directory leave the full batch available for the lock's records.

Reported by OSS Scanner: ANT-2026-Q3X5FCZO.

A crowded claims directory can keep a nonblocking acquisition busy well
past the caller's deadline. Treat an oversized scan as contention before
changing directory permissions, and cap abandoned-record cleanup work.
@gaborbernat gaborbernat added bug security Fixes a published or draft security advisory labels Nov 20, 2026
The first flood test stopped during POSIX directory validation, before
the acquisition scan. Add a case that fills the directory after
preflight, and avoid depending on directory iteration order when
checking abandoned-record cleanup.
@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 15:32
@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 marked this pull request as ready for review November 20, 2026 21:36
@gaborbernat
gaborbernat merged commit 158c903 into tox-dev:main Nov 20, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug security Fixes a published or draft security advisory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant