Merge #18596: test: Try once more when RPC connection fails on Windows

fab98992043f47fa7240d7c1217920d0c4f783a2 test: Try once more when RPC connection fails on Windows (MarcoFalke)
faa655731eac751d4eb494268e2c815493ba9382 test: Document why connection is re-constructed on windows (MarcoFalke)
fa9f4f663c36b0824406036445e5cff0a78174e9 test: Remove python 3.4 workaround (MarcoFalke)
fae760f2b24cb26494b65c0a7ac38b92ead345af cirrus: Bump freebsd to 12.1 (MarcoFalke)

Pull request description:

  Fixes: #18548

ACKs for top commit:
  hebasto:
    ACK fab98992043f47fa7240d7c1217920d0c4f783a2, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: c4e9ed8d995b63a820ca66984f152ac216c83ba1f318b61b15c6d375c0e936c08f6bc3d38c255dddf3ee8952f848c7ababf684854e07a7c1b1d8504e6b7208ba
This commit is contained in:
MarcoFalke 2020-04-13 09:35:39 -04:00 committed by pasta
parent d54e7c8197
commit af79508f7e
2 changed files with 13 additions and 10 deletions

View File

@ -1,7 +1,7 @@
task: task:
name: "FreeBsd 12.0 amd64 [GOAL: install] [no depends, only system libs]" name: "FreeBsd 12.1 amd64 [GOAL: install] [no depends, only system libs]"
freebsd_instance: freebsd_instance:
image: freebsd-12-0-release-amd64 image_family: freebsd-12-1 # https://cirrus-ci.org/guide/FreeBSD/
cpu: 8 cpu: 8
memory: 8G memory: 8G
timeout_in: 60m timeout_in: 60m

View File

@ -101,23 +101,26 @@ class AuthServiceProxy():
if os.name == 'nt': if os.name == 'nt':
# Windows somehow does not like to re-use connections # Windows somehow does not like to re-use connections
# TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows # TODO: Find out why the connection would disconnect occasionally and make it reusable on Windows
# Avoid "ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine"
self._set_conn() self._set_conn()
try: try:
self.__conn.request(method, path, postdata, headers) self.__conn.request(method, path, postdata, headers)
return self._get_response() return self._get_response()
except http.client.BadStatusLine as e: except (BrokenPipeError, ConnectionResetError):
if e.line == "''": # if connection was closed, try again # Python 3.5+ raises BrokenPipeError when the connection was reset
# ConnectionResetError happens on FreeBSD
self.__conn.close()
self.__conn.request(method, path, postdata, headers)
return self._get_response()
except OSError as e:
retry = (
'[WinError 10053] An established connection was aborted by the software in your host machine' in str(e))
if retry:
self.__conn.close() self.__conn.close()
self.__conn.request(method, path, postdata, headers) self.__conn.request(method, path, postdata, headers)
return self._get_response() return self._get_response()
else: else:
raise raise
except (BrokenPipeError, ConnectionResetError):
# Python 3.5+ raises BrokenPipeError instead of BadStatusLine when the connection was reset
# ConnectionResetError happens on FreeBSD with Python 3.4
self.__conn.close()
self.__conn.request(method, path, postdata, headers)
return self._get_response()
def get_request(self, *args, **argsn): def get_request(self, *args, **argsn):
AuthServiceProxy.__id_count += 1 AuthServiceProxy.__id_count += 1