From 3a9e1fda7ab30e04545d3eceea1f2ccd37fa1f15 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Fri, 5 Aug 2022 04:45:36 -0400 Subject: [PATCH] gh-95573: Reduce test data size in test_asyncio/test_ssl.py (GH-95668) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Langa --- Lib/test/test_asyncio/test_ssl.py | 19 ++++++++++++------- ...2-08-05-09-57-43.gh-issue-95573.edMdQB.rst | 6 ++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2022-08-05-09-57-43.gh-issue-95573.edMdQB.rst diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index a2b5f8d258c..5de9b7a14e8 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -5,6 +5,7 @@ import gc import logging import select import socket +import sys import tempfile import threading import time @@ -20,6 +21,10 @@ from test import support 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) @@ -191,8 +196,8 @@ class TestSSL(test_utils.TestCase): 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 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY @@ -287,8 +292,8 @@ class TestSSL(test_utils.TestCase): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 1024 - B_DATA = b'B' * 1024 * 1024 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, @@ -1034,8 +1039,8 @@ class TestSSL(test_utils.TestCase): 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 * BUF_MULTIPLIER + B_DATA = b'B' * 1024 * BUF_MULTIPLIER sslctx_1 = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) @@ -1178,7 +1183,7 @@ class TestSSL(test_utils.TestCase): CNT = 0 TOTAL_CNT = 25 - A_DATA = b'A' * 1024 * 1024 + A_DATA = b'A' * 1024 * BUF_MULTIPLIER sslctx = self._create_server_ssl_context( test_utils.ONLYCERT, test_utils.ONLYKEY) 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 00000000000..8580556965e --- /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.