only unlink the writer marker on release if it is still ours#566
Merged
gaborbernat merged 2 commits intoJun 19, 2026
Merged
Conversation
gaborbernat
requested changes
Jun 18, 2026
| @@ -379,7 +379,23 @@ def release(self, *, force: bool = False) -> None: | |||
| if hold.is_reader: | |||
Member
There was a problem hiding this comment.
src/filelock/_soft_rw/_sync.py:389: serialises ==> serializes
Contributor
Author
There was a problem hiding this comment.
good catch, fixed - switched it to serializes to match the rest of the tree.
gaborbernat
approved these changes
Jun 19, 2026
Contributor
Author
|
Thanks |
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.
If a writer is paused past stale_threshold (a long GC pause, SIGSTOP, a suspended VM) a peer evicts its now-stale .write marker, claims the writer slot and writes its own marker at the same path; the original holder still has _hold set, so on release it unlinks .write by path and deletes the peer's live marker, letting a second writer in and breaking mutual exclusion. The phase-2 timeout cleanup in _acquire_writer_slot has the same shape. Both now read the marker under the state lock and unlink only when the stored token is still ours, which is the same token re-check the stale-break path already relies on.