Skip to content

Commit 76e0e60

Browse files
committed
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
1 parent 25c45bb commit 76e0e60

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/functional/test_framework/test_node.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,15 @@ def suppress_error(category: str, e: Exception):
363363
latest_error = suppress_error(f"JSONRPCException {e.error['code']}", e)
364364
except OSError as e:
365365
error_num = e.errno
366-
# Work around issue where socket timeouts don't have errno set.
367-
# https://github.com/python/cpython/issues/109601
368-
if error_num is None and isinstance(e, TimeoutError):
369-
error_num = errno.ETIMEDOUT
366+
if error_num is None:
367+
# Work around issue where socket timeouts don't have errno set.
368+
# https://github.com/python/cpython/issues/109601
369+
if isinstance(e, TimeoutError):
370+
error_num = errno.ETIMEDOUT
371+
# http.client.RemoteDisconnected inherits from this type and
372+
# doesn't specify errno.
373+
elif isinstance(e, ConnectionResetError):
374+
error_num = errno.ECONNRESET
370375

371376
# Suppress similarly to the above JSONRPCException errors.
372377
if error_num not in [

0 commit comments

Comments
 (0)