]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128002: fix tsan race in closing socket in `test_ssl` (#131397)
authorKumar Aditya <kumaraditya@python.org>
Tue, 18 Mar 2025 10:11:43 +0000 (15:41 +0530)
committerGitHub <noreply@github.com>
Tue, 18 Mar 2025 10:11:43 +0000 (15:41 +0530)
Lib/test/test_asyncio/test_ssl.py

index ac774307c7942bc3a211c6e0b7e679c38c9f1a7a..986ecc2c5a964b235125c4f532e32505e47d34ca 100644 (file)
@@ -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: