Skip to content

Commit 9bc1964

Browse files
authored
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.
1 parent 81159fc commit 9bc1964

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/test/test_tracemalloc.py

+2
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,8 @@ def test_stop_untrack(self):
11031103

11041104
@unittest.skipIf(_testcapi is None, 'need _testcapi')
11051105
@threading_helper.requires_working_threading()
1106+
# gh-128679: Test crash on a debug build (especially on FreeBSD).
1107+
@unittest.skipIf(support.Py_DEBUG, 'need release build')
11061108
def test_tracemalloc_track_race(self):
11071109
# gh-128679: Test fix for tracemalloc.stop() race condition
11081110
_testcapi.tracemalloc_track_race()

0 commit comments

Comments
 (0)