Repository navigation
test(conftest): skip the tier-guard lock under an ancestor's shared hold (#2082) - #2086
Merged
Merged
Conversation
…old (#2082) A unit-tier test that runs a nested pytest holds the probe/scan lock shared for the whole run. Since the writer gate (#1977), a writer arriving meanwhile holds the gate while it waits on that hold, so the nested run's own shared requests queue behind it and the outer hold waits on the nested run: a deadlock only subprocess.run's 600 s timeout ended. On GraalPy's experimental leg, test_module_isolation failed this way in three runs, with ProbeWriteLockTests and another reader stalled ~590 s alongside it. The reader hold now exports PCAPKIT_TEST_TIER_GUARD_HELD, naming the lock file, for its duration; a process that inherits it for the same lock file skips the request, since the ancestor's hold already keeps the writer out. ProbeLockNestedRunTests reproduces the deadlock with a real child process (it times out at the gate without the fix) and pins the variable's scope.
Owner
Author
|
GOOD TO GO at
|
Contributor
|
Coverage: 91.54% (unit tier, Python 3.15,
Per-file detail: the |
Owner
Author
|
Ready to merge at |
4 of 5 tasks
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.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
test— adding missing tests or correcting existing testsDescription of your pull request and other information
Part of #2082. It fixes the deadlock that ate 600 s of GraalPy's last shard in 3 of the last 4 full runs. #2083, #2084 and #2085 hold the leg's other failures.
test_module_isolationholds the tier-guard lock shared while its nestedpytestruns.ProbeWriteLockTests) blocks new shared holds.tests/conftest.py's shared hold now setsPCAPKIT_TEST_TIER_GUARD_HELDto the lock path while it lasts. A child process that inherits it for the same lock skips its own request, because the parent's hold already keeps the writer out. The out-of-date "nothing here triggers it" comment is corrected.ProbeLockNestedRunTestsrecreates the deadlock with a real child process and a writer queued at the gate. With the fix disabled it times out; with it, it passes in 0.24 s. It also checks that the variable lasts only for the hold and that another lock's path is ignored.