-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-43468: Per instance locking for functools.cached_property #27609
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
Conversation
It looks like |
@@ -18,7 +18,7 @@ | |||
from collections import namedtuple | |||
# import types, weakref # Deferred to single_dispatch() | |||
from reprlib import recursive_repr | |||
from _thread import RLock | |||
from threading import RLock, Condition, get_ident |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change introduces an import cycle which causes tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a race condition on 980-983.
Scenario:
- 3 threads, 1 registered in
updaters
- 2nd and 3rd will wait
- both waiting threads will see registration of registered thread disappear
Mutual exclusion breaks.
Misc/NEWS.d/next/Library/2021-08-04-18-30-25.bpo-43468.PlU--J.rst
Outdated
Show resolved
Hide resolved
Can someone confirm or deny if my solution on twitter works?
I also made a PR here: rhettinger#7 |
candidate fix for deadlock
The following commit authors need to sign the Contributor License Agreement: |
Draft PR. It needs a NEWS entry, perhaps more tests, and perhaps some more factoring.
https://bugs.python.org/issue43468