Repository navigation
🐛 fix(api): skip mkdir on a nested acquire - #878
Merged
gaborbernat merged 2 commits intoOct 28, 2026
Merged
Conversation
The regression test branched on whether a file took the renamed directory's old name, so one case could mask the other and the ids read as booleans. Each case now supplies the step that occupies the old name, and the single directory check covers both outcomes. Adds the news fragment the fix needs, and shortens the comment at the guard to the two reasons it exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A program that renames the lock file's directory while it holds a
FileLockorSoftFileLock, then acquires the same lock again inside that hold, found the nested acquire recreating the directory under its old name. When a file had taken that name in the meantime, the nested acquire raisedFileExistsErrorand left the hold's recursion count one step too high, so leaving the outer block no longer released the lock. 🔒The lock now creates the parent directory only when it starts a fresh hold. A nested acquire joins the hold it already has, which keeps its original descriptor and path, so it has no reason to touch the filesystem. The first acquisition still creates the directory once before polling, so a directory that disappears while a contender waits fails that contender rather than building a second lock file beside the holder's, as before.
Programs that leave a held lock's directory in place see no change.