Repository navigation
SNOW-4058589: retry SSLError "Unexpected EOF" during TLS handshake - #3027
Merged
Merged
Conversation
A TLS handshake terminated by the peer surfaces in pyOpenSSL as
SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')"). The retry
gate only recognized "ECONNRESET" in repr(e), so this handshake failure
was classified non-retryable and raised OperationalError (errno 250003)
instead of being retried like ECONNRESET.
Widen the gate on both the sync (network.py) and async (aio/_network.py)
request paths to also retry when "Unexpected EOF" is present in repr(se).
Tests: add test_sslerror_with_unexpected_eof_retries and rename the
negative test to
test_sslerror_without_econnreset_or_unexpected_eof_does_not_retry,
on both sync and async paths. Add DESCRIPTION.md release note.
sfc-gh-dszmolka
force-pushed
the
SNOW-4058589-retry-unexpected-EOF
branch
from
September 4, 2026 08:24
f6a2f0a to
1359d9f
Compare
|
sfc-gh-dszmolka
marked this pull request as ready for review
September 4, 2026 08:49
| raw_ret.close() # ensure response is closed | ||
| except (aiohttp.ClientSSLError, aiohttp.ClientConnectorSSLError) as se: | ||
| if is_econnreset_exception(se): | ||
| if is_econnreset_exception(se) or "Unexpected EOF" in repr(se): |
Contributor
There was a problem hiding this comment.
Let's make it into is_unexpected_eof_exception to keep it aligned
Address review feedback on PR #3027: replace the inline "Unexpected EOF" in repr() check with a named is_unexpected_eof_exception() predicate, mirroring is_econnreset_exception, in both the sync and async SSLError retry handlers. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sfc-gh-turbaszek
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SnowflakeRestful._request_execonly retries anSSLErrorwhen itsrepr()containsECONNRESET. A TLS handshake aborted by the peer surfaces (via pyOpenSSL) asSSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')"), which does not match — so it is treated as non-retryable and raised asOperationalError(errno 250003).Impact
When the peer closes the connection mid-TLS-handshake — a transient, retryable condition — the request fails immediately instead of being retried, surfacing as a hard connection error. Affects both the sync and async request paths.
We got a customer complaint due to this.
Fix
Retry when
"Unexpected EOF"is present inrepr(se), alongside the existingECONNRESETcheck, innetwork.py(sync) andaio/_network.py(async).Tests
test_sslerror_with_unexpected_eof_retries(sync + async), assertingRetryRequest.test_sslerror_without_econnreset_or_unexpected_eof_does_not_retry.test_retry_networkunit tests pass (43, sync + async).