Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
test test_external_inspection failed -- Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/test/test_external_inspection.py", line 991, in test_only_active_thread
self.assertEqual(len(gil_traces), 1, "Should have exactly one GIL holder")
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1 : Should have exactly one GIL holder
See the failures in https://github.com/python/cpython/actions/runs/16006058028/job/45152923015 on main
cc @pablogsal
See also:
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-136186: Fix race condition in test_external_inspection.test_only_active_thread #136347
- [3.14] gh-136186: Fix race condition in test_external_inspection.test_only_active_thread (GH-136347) #136416
- gh-136186: Fix flaky tests in test_external_inspection #143110
- gh-136186: Fix more flaky tests in test_external_inspection #143235
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
pablogsal commentedon Jul 1, 2025
Will take a look 👀
StanFromIreland commentedon Jul 2, 2025
Also fails on buildbots, e.g. this run
vstinner commentedon Jul 2, 2025
I can reproduce the issue on Linux with the command:
sergey-miryanov commentedon Jul 2, 2025
With this command I got following error on Windows (JFYI):
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\\Sources\\_pythonish\\cpython\\main\\build\\test_python_50684\xe6'
pablogsal commentedon Jul 6, 2025
That's unfortunately another problem that's unique for windows. If you check the bug tracker you will see is a race between processes and the temporary directory
pythongh-136186: Fix race condition in test_external_inspection.test_…
gh-136186: Fix race condition in test_external_inspection.test_only_a…
pythongh-136186: Fix race condition in test_external_inspection.test_…
[3.14] gh-136186: Fix race condition in test_external_inspection.test…
pythongh-136186: Fix race condition in test_external_inspection.test_…
pythongh-136186: Fix race condition in test_external_inspection.test_…
pythongh-136186: Fix race condition in test_external_inspection.test_…
1 remaining item
pythongh-136186: Fix race condition in test_external_inspection.test_…
[3.14] pythongh-136186: Fix race condition in test_external_inspectio…
colesbury commentedon Dec 23, 2025
I'm still seeing flakiness with this test on CI. For example, on a PR (Hypothesis tests on Ubuntu):
https://github.com/python/cpython/actions/runs/20466572446/job/58811763808?pr=143109
pablogsal commentedon Dec 23, 2025
Let me look into it more
pablogsal commentedon Dec 23, 2025
Hopefully #143110 does the trick
Merge remote-tracking branch 'upstream/main' into pythongh-136186
Merge remote-tracking branch 'upstream/main' into pythongh-136186
Merge remote-tracking branch 'upstream/main' into pythongh-136186
gh-136186: Fix flaky tests in test_external_inspection (#143110)
pablogsal commentedon Dec 24, 2025
I ran buildbots in #143110 3 times and they were happy with it. Also I stress tested it locally and didn't see any failure so hopefully this is it
pythongh-136186: Fix more flaky tests in test_external_inspection
gh-136186: Fix more flaky tests in test_external_inspection (#143235)
pythongh-136186: Fix more flaky tests in test_external_inspection (py…