From 76e0e6087d0310ec31f43d751de60adf0c0a2faa Mon Sep 17 00:00:00 2001 From: Hodlinator <172445034+hodlinator@users.noreply.github.com> Date: Wed, 5 Nov 2025 10:44:56 +0100 Subject: [PATCH] qa: Account for errno not always being set for ConnectionResetError Logging issue can be triggered by: ```diff --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -263,6 +263,7 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m) /** HTTP request callback */ static void http_request_cb(struct evhttp_request* req, void* arg) { + throw std::runtime_error{"Hello"}; evhttp_connection* conn{evhttp_request_get_connection(req)}; // Track active requests { ``` http.client.RemoteDisconnected not specifying errno to ConnectionResetError-ctor: https://github.com/python/cpython/blob/ce4b0ede16aea62ee7b1e02df7e1538102a356da/Lib/http/client.py#L1556C9-L1556C29 --- test/functional/test_framework/test_node.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 4186cec5b75..06575a57654 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -363,10 +363,15 @@ class TestNode(): latest_error = suppress_error(f"JSONRPCException {e.error['code']}", e) except OSError as e: error_num = e.errno - # Work around issue where socket timeouts don't have errno set. - # https://github.com/python/cpython/issues/109601 - if error_num is None and isinstance(e, TimeoutError): - error_num = errno.ETIMEDOUT + if error_num is None: + # Work around issue where socket timeouts don't have errno set. + # https://github.com/python/cpython/issues/109601 + if isinstance(e, TimeoutError): + error_num = errno.ETIMEDOUT + # http.client.RemoteDisconnected inherits from this type and + # doesn't specify errno. + elif isinstance(e, ConnectionResetError): + error_num = errno.ECONNRESET # Suppress similarly to the above JSONRPCException errors. if error_num not in [