gh-154431: Fix data race in sys.audithook#154462
Conversation
|
GH-154477 is a backport of this pull request to the 3.15 branch. |
|
GH-154478 is a backport of this pull request to the 3.14 branch. |
|
Oh, @ambv looks like we can't really backport this. Because of the ABI change. What should we do? 🤔 |
|
Maybe we can reuse |
ZeroIntensity
left a comment
There was a problem hiding this comment.
Apologies for not reviewing in time. I'm not so sure that a lock was the best choice here.
I think it would have been better to just initialize the list eagerly rather than lazily, which is simpler and solves the ABI problem. Alternatively, you could use a compare-exchange loop or a once flag.
|
The commit 596cd5c introduced a reference leak: The test calls |
Test values are decreased, so this test can finish in a reasonable amount of time. It does not trigger in 100% of cases with TSAN enabled, but quite enought to notice its regressed failures in the future.
sys.addaudithook()lazily createsinterp->audit_hookswith no lock #154431