PR#2824: lib: is_conn_error catch more exceptions

Merges #2824
https://pagure.io/koji/pull-request/2824

Fixes: #2789
https://pagure.io/koji/issue/2789
is_conn_error fails to match BadStatusLine errors in some cases
This commit is contained in:
Tomas Kopecek 2021-04-28 13:34:47 +02:00
commit bdc2ca5f96

View file

@ -2275,7 +2275,11 @@ def is_conn_error(e):
# these values, this is a connection error.
if getattr(e, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
return True
if 'BadStatusLine' in str(e):
str_e = str(e)
if 'BadStatusLine' in str_e or \
'RemoteDisconnected' in str_e or \
'ConnectionReset' in str_e or \
'IncompleteRead' in str_e:
# we see errors like this in keep alive timeout races
# ConnectionError(ProtocolError('Connection aborted.', BadStatusLine("''",)),)
return True