Skip to content

Commit d9fd7b5

Browse files
author
MarcoFalke
committed
Merge bitcoin#18596: test: Try once more when RPC connection fails on Windows
fab9899 test: Try once more when RPC connection fails on Windows (MarcoFalke) faa6557 test: Document why connection is re-constructed on windows (MarcoFalke) fa9f4f6 test: Remove python 3.4 workaround (MarcoFalke) fae760f cirrus: Bump freebsd to 12.1 (MarcoFalke) Pull request description: Fixes: bitcoin#18548 ACKs for top commit: hebasto: ACK fab9899, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: c4e9ed8d995b63a820ca66984f152ac216c83ba1f318b61b15c6d375c0e936c08f6bc3d38c255dddf3ee8952f848c7ababf684854e07a7c1b1d8504e6b7208ba
2 parents d578398 + fab9899 commit d9fd7b5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

.cirrus.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
task:
2-
name: "FreeBsd 12.0 amd64 [GOAL: install] [no depends, only system libs]"
2+
name: "FreeBsd 12.1 amd64 [GOAL: install] [no depends, only system libs]"
33
freebsd_instance:
4-
image: freebsd-12-0-release-amd64
4+
image_family: freebsd-12-1 # https://cirrus-ci.org/guide/FreeBSD/
55
cpu: 8
66
memory: 8G
77
timeout_in: 60m

test/functional/test_framework/authproxy.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,26 @@ def _request(self, method, path, postdata):
101101
if os.name == 'nt':
102102
# Windows somehow does not like to re-use connections
103103
# TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows
104+
# Avoid "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine"
104105
self._set_conn()
105106
try:
106107
self.__conn.request(method, path, postdata, headers)
107108
return self._get_response()
108-
except http.client.BadStatusLine as e:
109-
if e.line == "''": # if connection was closed, try again
109+
except (BrokenPipeError, ConnectionResetError):
110+
# Python 3.5+ raises BrokenPipeError when the connection was reset
111+
# ConnectionResetError happens on FreeBSD
112+
self.__conn.close()
113+
self.__conn.request(method, path, postdata, headers)
114+
return self._get_response()
115+
except OSError as e:
116+
retry = (
117+
'[WinError 10053] An established connection was aborted by the software in your host machine' in str(e))
118+
if retry:
110119
self.__conn.close()
111120
self.__conn.request(method, path, postdata, headers)
112121
return self._get_response()
113122
else:
114123
raise
115-
except (BrokenPipeError, ConnectionResetError):
116-
# Python 3.5+ raises BrokenPipeError instead of BadStatusLine when the connection was reset
117-
# ConnectionResetError happens on FreeBSD with Python 3.4
118-
self.__conn.close()
119-
self.__conn.request(method, path, postdata, headers)
120-
return self._get_response()
121124

122125
def get_request(self, *args, **argsn):
123126
AuthServiceProxy.__id_count += 1

0 commit comments

Comments
 (0)