Track the context lock grant by generation instead of identity - #2306
Open
fzyzcjy wants to merge 1 commit into
Open
Track the context lock grant by generation instead of identity#2306fzyzcjy wants to merge 1 commit into
fzyzcjy wants to merge 1 commit into
Conversation
fzyzcjy
requested review from
Shi-Dong,
Zhichenzzz,
guapisolo,
jybsuper,
maocheng23 and
yueming-yuan
as code owners
August 10, 2026 16:08
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 10, 2026 16:33
5c3ea6c to
3d6d377
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
2 times, most recently
from
August 12, 2026 02:48
da51a5d to
78fa1e8
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 12, 2026 02:48
3d6d377 to
713dea7
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
from
August 12, 2026 09:32
78fa1e8 to
582433e
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 12, 2026 14:31
2dcc80e to
ee4fcd8
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
from
August 12, 2026 14:31
582433e to
4b77013
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 12, 2026 14:36
ee4fcd8 to
8ac71f7
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
from
August 12, 2026 14:36
4b77013 to
353701e
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 12, 2026 23:56
8ac71f7 to
df3785e
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
2 times, most recently
from
August 13, 2026 01:13
9cda90f to
b9f6c85
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 13, 2026 01:13
df3785e to
ba00f18
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
2 times, most recently
from
August 13, 2026 03:25
fdd4378 to
e4d25da
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 13, 2026 06:00
60ddb90 to
bc4c262
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
from
August 13, 2026 06:00
e4d25da to
b792f3e
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 13, 2026 06:39
bc4c262 to
0897379
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
2 times, most recently
from
August 14, 2026 04:45
548c5ac to
eb802e1
Compare
This was referenced Aug 28, 2026
A child task spawned inside a critical section inherits the holder's contextvars, so under the identity model it kept believing it held the lock after the holder let go. Stamp each grant with a generation the lock invalidates on release, detach and re-acquire, so an inherited grant expires the moment the section it belonged to ends. detach() expires the generation rather than merely clearing the holder's own contextvar, and reattach() issues a fresh one behind a locked-state assert, so no grant can outlive its window or name a generation that is no longer active. acquire() and reattach() share one check: a live grant blocks, an expired one does not. Tests not executed (test run ban); statically checked only.
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-123
branch
from
August 29, 2026 12:38
cfca09e to
ca730fd
Compare
fzyzcjy
force-pushed
the
tom/refactor-miles/op13-164
branch
from
August 29, 2026 12:38
eb802e1 to
6adfc83
Compare
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.
Part of #1837