diff --git a/CHANGES.rst b/CHANGES.rst index 1ae7c2de6a2..15615bb9e6a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,83 @@ .. towncrier release notes start +3.11.14 (2025-03-16) +==================== + +Bug fixes +--------- + +- Fixed an issue where dns queries were delayed indefinitely when an exception occurred in a ``trace.send_dns_cache_miss`` + -- by :user:`logioniz`. + + + *Related issues and pull requests on GitHub:* + :issue:`10529`. + + + +- Fixed DNS resolution on platforms that don't support ``socket.AI_ADDRCONFIG`` -- by :user:`maxbachmann`. + + + *Related issues and pull requests on GitHub:* + :issue:`10542`. + + + +- The connector now raises :exc:`aiohttp.ClientConnectionError` instead of :exc:`OSError` when failing to explicitly close the socket after :py:meth:`asyncio.loop.create_connection` fails -- by :user:`bdraco`. + + + *Related issues and pull requests on GitHub:* + :issue:`10551`. + + + +- Break cyclic references at connection close when there was a traceback -- by :user:`bdraco`. + + Special thanks to :user:`availov` for reporting the issue. + + + *Related issues and pull requests on GitHub:* + :issue:`10556`. + + + +- Break cyclic references when there is an exception handling a request -- by :user:`bdraco`. + + + *Related issues and pull requests on GitHub:* + :issue:`10569`. + + + + +Features +-------- + +- Improved logging on non-overlapping WebSocket client protocols to include the remote address -- by :user:`bdraco`. + + + *Related issues and pull requests on GitHub:* + :issue:`10564`. + + + + +Miscellaneous internal changes +------------------------------ + +- Improved performance of parsing content types by adding a cache in the same manner currently done with mime types -- by :user:`bdraco`. + + + *Related issues and pull requests on GitHub:* + :issue:`10552`. + + + + +---- + + 3.11.13 (2025-02-24) ==================== diff --git a/CHANGES/10529.bugfix.rst b/CHANGES/10529.bugfix.rst deleted file mode 100644 index d6714ffd043..00000000000 --- a/CHANGES/10529.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed an issue where dns queries were delayed indefinitely when an exception occurred in a ``trace.send_dns_cache_miss`` --- by :user:`logioniz`. diff --git a/CHANGES/10551.bugfix.rst b/CHANGES/10551.bugfix.rst deleted file mode 100644 index 8f3eb24d6ae..00000000000 --- a/CHANGES/10551.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The connector now raises :exc:`aiohttp.ClientConnectionError` instead of :exc:`OSError` when failing to explicitly close the socket after :py:meth:`asyncio.loop.create_connection` fails -- by :user:`bdraco`. diff --git a/CHANGES/10552.misc.rst b/CHANGES/10552.misc.rst deleted file mode 100644 index 6755cbf7396..00000000000 --- a/CHANGES/10552.misc.rst +++ /dev/null @@ -1 +0,0 @@ -Improved performance of parsing content types by adding a cache in the same manner currently done with mime types -- by :user:`bdraco`. diff --git a/CHANGES/10556.bugfix.rst b/CHANGES/10556.bugfix.rst deleted file mode 100644 index aad4eccbe48..00000000000 --- a/CHANGES/10556.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Break cyclic references at connection close when there was a traceback -- by :user:`bdraco`. - -Special thanks to :user:`availov` for reporting the issue. diff --git a/CHANGES/10564.feature.rst b/CHANGES/10564.feature.rst deleted file mode 100644 index 24e2ecad76d..00000000000 --- a/CHANGES/10564.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Improved logging on non-overlapping WebSocket client protocols to include the remote address -- by :user:`bdraco`. diff --git a/CHANGES/10569.bugfix.rst b/CHANGES/10569.bugfix.rst deleted file mode 100644 index 7d817e867d4..00000000000 --- a/CHANGES/10569.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Break cyclic references when there is an exception handling a request -- by :user:`bdraco`. diff --git a/aiohttp/resolver.py b/aiohttp/resolver.py index 9528cfe48da..d99970f3952 100644 --- a/aiohttp/resolver.py +++ b/aiohttp/resolver.py @@ -18,6 +18,9 @@ _NUMERIC_SOCKET_FLAGS = socket.AI_NUMERICHOST | socket.AI_NUMERICSERV _NAME_SOCKET_FLAGS = socket.NI_NUMERICHOST | socket.NI_NUMERICSERV +_AI_ADDRCONFIG = socket.AI_ADDRCONFIG +if hasattr(socket, "AI_MASK"): + _AI_ADDRCONFIG &= socket.AI_MASK class ThreadedResolver(AbstractResolver): @@ -38,7 +41,7 @@ async def resolve( port, type=socket.SOCK_STREAM, family=family, - flags=socket.AI_ADDRCONFIG, + flags=_AI_ADDRCONFIG, ) hosts: List[ResolveResult] = [] @@ -96,7 +99,7 @@ async def resolve( port=port, type=socket.SOCK_STREAM, family=family, - flags=socket.AI_ADDRCONFIG, + flags=_AI_ADDRCONFIG, ) except aiodns.error.DNSError as exc: msg = exc.args[1] if len(exc.args) >= 1 else "DNS lookup failed" diff --git a/tests/test_leaks.py b/tests/test_leaks.py index f527ce18cae..07b506bdb99 100644 --- a/tests/test_leaks.py +++ b/tests/test_leaks.py @@ -9,34 +9,29 @@ @pytest.mark.skipif(IS_PYPY, reason="gc.DEBUG_LEAK not available on PyPy") -def test_client_response_does_not_leak_on_server_disconnected_error() -> None: - """Test that ClientResponse is collected after server disconnects. - - https://github.com/aio-libs/aiohttp/issues/10535 - """ - leak_test_script = pathlib.Path(__file__).parent.joinpath( - "isolated", "check_for_client_response_leak.py" - ) - - with subprocess.Popen( - [sys.executable, "-u", str(leak_test_script)], - stdout=subprocess.PIPE, - ) as proc: - assert proc.wait() == 0, "ClientResponse leaked" - - -@pytest.mark.skipif(IS_PYPY, reason="gc.DEBUG_LEAK not available on PyPy") -def test_request_does_not_leak_when_request_handler_raises() -> None: - """Test that the Request object is collected when the handler raises. - - https://github.com/aio-libs/aiohttp/issues/10548 - """ - leak_test_script = pathlib.Path(__file__).parent.joinpath( - "isolated", "check_for_request_leak.py" - ) +@pytest.mark.parametrize( + ("script", "message"), + [ + ( + # Test that ClientResponse is collected after server disconnects. + # https://github.com/aio-libs/aiohttp/issues/10535 + "check_for_client_response_leak.py", + "ClientResponse leaked", + ), + ( + # Test that Request object is collected when the handler raises. + # https://github.com/aio-libs/aiohttp/issues/10548 + "check_for_request_leak.py", + "Request leaked", + ), + ], +) +def test_leak(script: str, message: str) -> None: + """Run isolated leak test script and check for leaks.""" + leak_test_script = pathlib.Path(__file__).parent.joinpath("isolated", script) with subprocess.Popen( [sys.executable, "-u", str(leak_test_script)], stdout=subprocess.PIPE, ) as proc: - assert proc.wait() == 0, "Request leaked" + assert proc.wait() == 0, message