-
-
Notifications
You must be signed in to change notification settings - Fork 32k
_py_abc
Python implementation of abc
is not thread-safe
#130095
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
Comments
I'm not really sure what to do here. We could add a cc @cfbolz in case you have thoughts on this. |
Not sure if this is relevant: https://github.com/python/cpython/actions/runs/13335219139/job/37248893358?pr=129175 (I don't know if the test is testing the Python or the C implementation). EDIT: I think this is the reproducer you had. But now we caught it in the CI |
The `_py_abc` implementation is not currently thread-safe (even with the GIL). Don't run these tests with `--parallel-threads=N` for now.
Thanks @picnixz. I put up a PR to avoid running them with |
yeah, importing threading in |
hm, doesn't quite work, because |
If I'm right, the problem comes from three bytecode operations: Sorry if I'm obvious. |
The pure Python companion modules like |
Thanks for the link - it is useful for my understanding. |
@colesbury if you are specifically concerned about pypy, we don't use |
Thanks for the clarification. I also noticed a failure when I substituted If neither pypy nor CPython use |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
The update to the invalidation counter is not thread-safe and can lose updates in some Python implementations:
Failures seen on:
But not on Python 3.10-3.14 with GIL due to limited GIL switch opportunities.
cpython/Lib/_py_abc.py
Lines 54 to 70 in 05e89c3
For example, consider the following repro, adapted from
test_abc.test_registration_basics
:Linked PRs
_py_abc
tests as not thread-safe #130131The text was updated successfully, but these errors were encountered: