Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ericsnowcurrently opened this issue Jun 14, 2024 · 2 comments
Assignees
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented Jun 14, 2024

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

@ericsnowcurrently
Copy link
Member Author

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

ericsnowcurrently added a commit that referenced this issue Jun 17, 2024
…nterp_count (gh-120529)

gh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 17, 2024
…s[i].interp_count (pythongh-120529)

pythongh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.
(cherry picked from commit 2c66318)

Co-authored-by: Eric Snow <[email protected]>
@ericsnowcurrently
Copy link
Member Author

I've landed the proper fix.

ericsnowcurrently added a commit that referenced this issue Jun 17, 2024
…es[i].interp_count (gh-120657)

gh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.

(cherry picked from commit 2c66318, AKA gh-120529)

Co-authored-by: Eric Snow <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
…s[i].interp_count (pythongh-120529)

pythongh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
…s[i].interp_count (pythongh-120529)

pythongh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
…s[i].interp_count (pythongh-120529)

pythongh-120182 added new global state (interp_count), but didn't add thread-safety for it.  This change eliminates the possible race.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant