Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit341ff68

Browse files
Retry on connection timeout (#103)
A lot of the time we see the error `[Errno 110] Connection timed out`. This happens a lot in Azure, particularly. In this PR I make it a retryable error as it is safeSigned-off-by: Andre Furlan <andre.furlan@databricks.com>
1 parent82925ec commit341ff68

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,6 @@ cython_debug/
202202
databricks_sql_connector.egg-info/
203203
dist/
204204
build/
205+
206+
# vs code stuff
207+
.vscode

‎src/databricks/sql/thrift_backend.py‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -322,27 +322,27 @@ def attempt_request(attempt):
322322
exceptOSErroraserr:
323323
error=err
324324
error_message=str(err)
325+
# fmt: off
326+
# The built-in errno package encapsulates OSError codes, which are OS-specific.
327+
# log.info for errors we believe are not unusual or unexpected. log.warn for
328+
# for others like EEXIST, EBADF, ERANGE which are not expected in this context.
329+
#
330+
# I manually tested this retry behaviour using mitmweb and confirmed that
331+
# GetOperationStatus requests are retried when I forced network connection
332+
# interruptions / timeouts / reconnects. See #24 for more info.
333+
# | Debian | Darwin |
334+
info_errs= [# |--------|--------|
335+
errno.ESHUTDOWN,# | 32 | 32 |
336+
errno.EAFNOSUPPORT,# | 97 | 47 |
337+
errno.ECONNRESET,# | 104 | 54 |
338+
errno.ETIMEDOUT,# | 110 | 60 |
339+
]
325340

326341
gos_name=TCLIServiceClient.GetOperationStatus.__name__
327-
ifmethod.__name__==gos_name:
342+
# retry on timeout. Happens a lot in Azure and it is safe as data has not been sent to server yet
343+
ifmethod.__name__==gos_nameorerr.errno==errno.ETIMEDOUT:
328344
retry_delay=bound_retry_delay(attempt,self._retry_delay_default)
329345

330-
# fmt: off
331-
# The built-in errno package encapsulates OSError codes, which are OS-specific.
332-
# log.info for errors we believe are not unusual or unexpected. log.warn for
333-
# for others like EEXIST, EBADF, ERANGE which are not expected in this context.
334-
#
335-
# I manually tested this retry behaviour using mitmweb and confirmed that
336-
# GetOperationStatus requests are retried when I forced network connection
337-
# interruptions / timeouts / reconnects. See #24 for more info.
338-
# | Debian | Darwin |
339-
info_errs= [# |--------|--------|
340-
errno.ESHUTDOWN,# | 32 | 32 |
341-
errno.EAFNOSUPPORT,# | 97 | 47 |
342-
errno.ECONNRESET,# | 104 | 54 |
343-
errno.ETIMEDOUT,# | 110 | 60 |
344-
]
345-
346346
# fmt: on
347347
log_string=f"{gos_name} failed with code{err.errno} and will attempt to retry"
348348
iferr.errnoininfo_errs:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp