Closed
Description
Crash report
What happened?
There is a race in initialization of static builtin types. gh-120182 introduced an assert which has exposed the race. (The 3.13 backport, gh-120518, exposed the same race.)
The problem was identified by multiple stable buildbots, both on main and 3.13. Here's the error:
Assertion failed: (_PyRuntime.types.managed_static.types[full_index].interp_count > 0), function managed_static_type_state_clear, file typeobject.c, line 296.
I was able to reproduce this locally with the following command:
./python -m test test_interpreters -m test_create_many_threaded -v -u cpu --forever
My debugger indicates that there are two threads hitting that assert at the same time, simultaneously trying to finalize PyStdPrinter_Type
, though I expect which type hits the race would vary.
I plan on tracking down the problem but in the meantime I'm going to temporarily skip test_create_many_threaded()
to get the buildbots back to green.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Linked PRs
- gh-120524: Temporarily Skip test_create_many_threaded In test_interpreters.test_stress #120525
- [3.13] gh-120524: Temporarily Skip test_create_many_threaded In test_interpreters.test_stress #120527
- gh-120524: Avoid a Race On _PyRuntime.types.managed_static.types[i].interp_count #120529
- [3.13] gh-120524: Avoid a Race On _PyRuntime.types.managed_static.types[i].interp_count (gh-120529) #120657