Skip to content

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

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

Activity

  1. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-crashA hard crash of the interpreter, possibly with a core dump
    3.13only security fixes
    3.14bugs and security fixes
    on Jun 14, 2024
  2. added 2 commits that reference this issue on Jun 14, 2024
  3. ericsnowcurrently commented on Jun 15, 2024

    @ericsnowcurrently
    MemberAuthor

    I've temporarily disabled the failing test. I'll land an actual fix probably Monday.

  4. added 2 commits that reference this issue on Jun 17, 2024
  5. added a commit that references this issue on Jun 17, 2024
  6. ericsnowcurrently commented on Jun 17, 2024

    @ericsnowcurrently
    MemberAuthor

    I've landed the proper fix.

  7. added a commit that references this issue on Jun 17, 2024
  8. added 2 commits that reference this issue on Jun 30, 2024
  9. added 2 commits that reference this issue on Jul 11, 2024
  10. added 2 commits that reference this issue on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.13only 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