Skip to content

Commit c3db95c

Browse files
sfc-gh-stakedaankit-bhatnagar167
authored andcommitted
SNOW-91104: Retry IncompleteRead exception.
1 parent 04765c4 commit c3db95c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
FORBIDDEN = httplib.FORBIDDEN
6262
UNAUTHORIZED = httplib.UNAUTHORIZED
6363
INTERNAL_SERVER_ERROR = httplib.INTERNAL_SERVER_ERROR
64+
IncompleteRead = httplib.IncompleteRead
6465
OK = httplib.OK
6566
BadStatusLine = httplib.BadStatusLine
6667

@@ -105,6 +106,7 @@
105106
FORBIDDEN = http.client.FORBIDDEN
106107
UNAUTHORIZED = http.client.UNAUTHORIZED
107108
INTERNAL_SERVER_ERROR = http.client.INTERNAL_SERVER_ERROR
109+
IncompleteRead = http.client.IncompleteRead
108110
OK = http.client.OK
109111
BadStatusLine = http.client.BadStatusLine
110112

network.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
METHOD_NOT_ALLOWED, BAD_REQUEST, SERVICE_UNAVAILABLE, GATEWAY_TIMEOUT,
3333
FORBIDDEN, BAD_GATEWAY, REQUEST_TIMEOUT,
3434
UNAUTHORIZED, INTERNAL_SERVER_ERROR, OK, BadStatusLine)
35-
from .compat import (TO_UNICODE, urlencode, urlparse)
35+
from .compat import (TO_UNICODE, urlencode, urlparse, IncompleteRead)
3636
from .constants import (
3737
HTTP_HEADER_CONTENT_TYPE,
3838
HTTP_HEADER_ACCEPT,
@@ -855,6 +855,7 @@ def _request_exec(
855855
ReadTimeout,
856856
BadStatusLine,
857857
ConnectionError,
858+
IncompleteRead,
858859
SSLError,
859860
ProtocolError, # from urllib3
860861
ReadTimeoutError, # from urllib3

test/test_unit_retry_network.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
BAD_REQUEST,
2626
BAD_GATEWAY,
2727
UNAUTHORIZED,
28-
BadStatusLine)
28+
BadStatusLine,
29+
IncompleteRead)
2930
from snowflake.connector.errors import (
3031
InterfaceError, DatabaseError, OtherHTTPRetryableError)
3132
from snowflake.connector.network import (
@@ -117,10 +118,15 @@ def test_request_exec():
117118
session=session, catch_okta_unauthorized_error=True,
118119
**default_parameters)
119120

121+
class IncompleteReadMock(IncompleteRead):
122+
def __init__(self):
123+
IncompleteRead.__init__(self, "")
124+
120125
# handle retryable exception
121126
for exc in [
122127
ConnectTimeout,
123128
ReadTimeout,
129+
IncompleteReadMock,
124130
SSLError,
125131
ProtocolError,
126132
ConnectionError,

0 commit comments

Comments
 (0)