https://github.com/python/cpython/commit/9bc19643ed54b2aa8558e87fd3a04e8bd1ea7fb2
commit: 9bc19643ed54b2aa8558e87fd3a04e8bd1ea7fb2
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-01-18T15:13:54Z
summary:
gh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)
There is a race condition between PyMem_SetAllocator() and
PyMem_RawMalloc()/PyMem_RawFree(). While PyMem_SetAllocator() write
is protected by a lock, PyMem_RawMalloc()/PyMem_RawFree() reads are
not protected by a lock. PyMem_RawMalloc()/PyMem_RawFree() can be
called with an old context and the new function pointer.
On a release build, it's not an issue since the context is not used.
On a debug build, the debug hooks use the context and so can crash.
files:
M Lib/test/test_tracemalloc.py
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index da2db28775578a..a848363fcd1de9 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -1103,6 +1103,8 @@ def test_stop_untrack(self):
@unittest.skipIf(_testcapi is None, 'need _testcapi')
@threading_helper.requires_working_threading()
+ # gh-128679: Test crash on a debug build (especially on FreeBSD).
+ @unittest.skipIf(support.Py_DEBUG, 'need release build')
def test_tracemalloc_track_race(self):
# gh-128679: Test fix for tracemalloc.stop() race condition
_testcapi.tracemalloc_track_race()
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]