Repository navigation
fix(session): avoid Windows lock-file initialization race - #102
Merged
cyruszhang merged 2 commits intoOct 19, 2026
Merged
Conversation
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.
Concurrent Windows session workers can both observe an empty lock file. One worker may lock its first byte before the other writes the initialization byte, causing
PermissionError; cleanup then attempts to release a lock that was never acquired and can leak the descriptor. This caused the Native Windows failure on #99.Remove the initialization write: Windows byte-range locks support locking beyond EOF. Release only successfully acquired locks and always close the descriptor, including when acquisition or release fails. Existing one-byte lock files remain compatible.
Validation:
git diff --checkpass.Windows API behavior: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/locking
CI prerequisite shared with #101: refresh the standalone Context lockfile from aiohttp 3.14.3 to the workspace's existing 3.14.5, with its required yarl update, to resolve three audit findings. Standalone
pip-auditreports no known vulnerabilities.