Skip to content

don't complete a writer acquire on a peer's reclaimed marker#571

Open
dxbjavid wants to merge 1 commit into
tox-dev:mainfrom
dxbjavid:writer-phase2-token-check
Open

don't complete a writer acquire on a peer's reclaimed marker#571
dxbjavid wants to merge 1 commit into
tox-dev:mainfrom
dxbjavid:writer-phase2-token-check

Conversation

@dxbjavid

Copy link
Copy Markdown
Contributor

the writer acquire is two-phase, and in phase 2 (waiting for readers to drain) it refreshes the .write marker on every scan. if the writer is paused longer than stale_threshold a peer can evict that now-stale marker and reclaim the slot with its own token, but phase 2 carried on touching whatever sat at the path and reported success once the readers had gone, so the original writer would finish its acquire on top of the peer's live marker and two writers could end up believing they hold the exclusive lock at the same time. this re-checks that the marker still carries our token before refreshing it, the same identity check the heartbeat refresh and the release path already rely on, and re-claims the slot (waiting behind the peer when it currently holds .write) instead of trusting a foreign marker. the regression test drives the eviction mid phase-2 and asserts the acquire no longer completes on a stranger's marker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant