From 428491342d2affd759933e1337a9419bd43ec2cc Mon Sep 17 00:00:00 2001 From: Fantix King Date: Thu, 4 Aug 2022 14:57:41 -0400 Subject: [PATCH 1/4] gh-95573: Reduce test data size in test_asyncio/test_ssl.py --- Lib/test/test_asyncio/test_ssl.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index 5e3c1573c9c5871..b66cb0f4dd51e6b 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -181,8 +181,8 @@ def test_create_server_ssl_1(self): TOTAL_CNT = 25 # total number of clients that test will create TIMEOUT = support.LONG_TIMEOUT # timeout for this test - A_DATA = b'A' * 1024 * 1024 - B_DATA = b'B' * 1024 * 1024 + A_DATA = b'A' * 1024 * 64 + B_DATA = b'B' * 1024 * 64 sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY @@ -277,8 +277,8 @@ def test_create_connection_ssl_1(self): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 1024 - B_DATA = b'B' * 1024 * 1024 + A_DATA = b'A' * 1024 * 64 + B_DATA = b'B' * 1024 * 64 sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, @@ -1024,8 +1024,8 @@ def test_create_server_ssl_over_ssl(self): TOTAL_CNT = 25 # total number of clients that test will create TIMEOUT = support.LONG_TIMEOUT # timeout for this test - A_DATA = b'A' * 1024 * 1024 - B_DATA = b'B' * 1024 * 1024 + A_DATA = b'A' * 1024 * 64 + B_DATA = b'B' * 1024 * 64 sslctx_1 = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) @@ -1168,7 +1168,7 @@ def test_shutdown_cleanly(self): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 1024 + A_DATA = b'A' * 1024 * 64 sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) From aad8a26dd82bf7b9c522dd81bb95d46e55f3d5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 5 Aug 2022 09:57:49 +0200 Subject: [PATCH 2/4] Add Blurb --- .../Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst diff --git a/Misc/NEWS.d/next/Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst b/Misc/NEWS.d/next/Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst new file mode 100644 index 000000000000000..8580556965e1dab --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst @@ -0,0 +1,6 @@ +:source:`Lib/test/test_asyncio/test_ssl.py` exposed a bug in the macOS +kernel where intense concurrent load on non-blocking sockets occasionally +causes :const:`errno.ENOBUFS` ("No buffer space available") to be emitted. +FB11063974 filed with Apple, in the mean time as a workaround buffer size +used in tests on macOS is decreased to avoid intermittent failures. Patch +by Fantix King. From 474cae5acfdca24155bfabbde130b66141635f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 5 Aug 2022 10:06:57 +0200 Subject: [PATCH 3/4] Only decrease the buffer size on macOS --- Lib/test/test_asyncio/test_ssl.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index b66cb0f4dd51e6b..3f603dc99c07695 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -20,6 +20,10 @@ from test.test_asyncio import utils as test_utils +MACOS = (sys.platform == 'darwin') +BUF_MULTIPLIER = 1024 if not MACOS else 64 + + def tearDownModule(): asyncio.set_event_loop_policy(None) @@ -181,8 +185,8 @@ def test_create_server_ssl_1(self): TOTAL_CNT = 25 # total number of clients that test will create TIMEOUT = support.LONG_TIMEOUT # timeout for this test - A_DATA = b'A' * 1024 * 64 - B_DATA = b'B' * 1024 * 64 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY @@ -277,8 +281,8 @@ def test_create_connection_ssl_1(self): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 64 - B_DATA = b'B' * 1024 * 64 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, @@ -1024,8 +1028,8 @@ def test_create_server_ssl_over_ssl(self): TOTAL_CNT = 25 # total number of clients that test will create TIMEOUT = support.LONG_TIMEOUT # timeout for this test - A_DATA = b'A' * 1024 * 64 - B_DATA = b'B' * 1024 * 64 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx_1 = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) @@ -1168,7 +1172,7 @@ def test_shutdown_cleanly(self): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 64 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) From 60ce74d8681604f7991d3b18cfa86146e45918c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 5 Aug 2022 10:11:01 +0200 Subject: [PATCH 4/4] Actually import sys --- Lib/test/test_asyncio/test_ssl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index e8a7bc947adb2a2..5de9b7a14e87da3 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -5,6 +5,7 @@ import logging import select import socket +import sys import tempfile import threading import time