Skip to content

Commit de7675c

Browse files
itamarometa-codesync[bot]
authored andcommitted
Clean up stopped test threads under ASAN
Summary: AddressSanitizer can retain stopped TestThread objects after their OS threads have joined. This leaves those objects in threading._dangling and makes regrtest report ENV CHANGED even though all threading tests pass. After joining every test thread and asserting that it has stopped, remove these test-owned objects from the private diagnostic weak set on ASAN builds. Normal builds retain the existing dangling-thread leak detection. Keep the replayable 3.14 patch and its metadata synchronized with the patched tree. Reviewed By: yoney Differential Revision: D122693875 fbshipit-source-id: 9020eaac9da67d7625193dcde3f1feef81cff31e
1 parent 97e7f5a commit de7675c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎Lib/test/test_threading.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ def test_various_ops(self):
231231
if verbose:
232232
print('all tasks done')
233233
self.assertEqual(numrunning.get(), 0)
234+
if support.check_sanitizer(address=True):
235+
# ASAN can retain stopped Thread objects after their OS threads join.
236+
threading._dangling.difference_update(threads)
234237

235238
def test_ident_of_no_threading_threads(self):
236239
# The ident still must work for the main thread and dummy threads.

0 commit comments

Comments
 (0)