From: Kumar Aditya Date: Tue, 18 Mar 2025 10:11:43 +0000 (+0530) Subject: gh-128002: fix tsan race in closing socket in `test_ssl` (#131397) X-Git-Tag: v3.14.0a7~331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0a4f6599a7d36cc08fe63d6f7d5d4dea64579f3;p=thirdparty%2FPython%2Fcpython.git gh-128002: fix tsan race in closing socket in `test_ssl` (#131397) --- diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index ac774307c794..986ecc2c5a96 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -1849,16 +1849,14 @@ class TestThreadedServer(SocketThread): pass finally: super().stop() - - def run(self): - try: - with self._sock: - self._sock.setblocking(False) - self._run() - finally: + self._sock.close() self._s1.close() self._s2.close() + def run(self): + self._sock.setblocking(False) + self._run() + def _run(self): while self._active: if self._clients >= self._max_clients: