Skip to content

test_create_many_threaded() of test_interpreters.test_stress Hitting an Assert #120524

Closed
@ericsnowcurrently

Description

@ericsnowcurrently

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

Metadata

Metadata

Labels

3.13bugs and security fixes3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions