Retry on HTTP 200 with empty response body#603
Open
emanuelsdsj wants to merge 1 commit intotrinodb:masterfrom
Open
Retry on HTTP 200 with empty response body#603emanuelsdsj wants to merge 1 commit intotrinodb:masterfrom
emanuelsdsj wants to merge 1 commit intotrinodb:masterfrom
Conversation
When Trino returns HTTP 200 with an empty body under load, the client was crashing with a bare JSONDecodeError. Treat this as a transient condition and retry using the existing backoff mechanism, consistent with how 429/502/503/504 are handled. If retries are exhausted, raise TrinoConnectionError with a descriptive message. Fixes trinodb#596
Member
Author
|
I believe that both failures are related to the installation of dependencies, even before any tests were run. |
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.
Description
fixed #596
TrinoRequest.process()callsjson.loads(http_response.text)immediately after checking
http_response.ok. When Trino returnsHTTP 200 with an empty body under load, this raises a bare
JSONDecodeErrorthat is not in thehandled_exceptionslist of_retry_with, so no retry is attempted and the exceptionpropagates unhandled to the caller.
Two changes to address this:
max_attempts.setterfor HTTP 200responses with an empty body, so the existing exponential
backoff mechanism retries them — consistent with how 429/502/
503/504 are already handled.
process()that raisesTrinoConnectionErrorwith a descriptive message if an empty body reaches that point
(e.g. after retries are exhausted), instead of leaking a raw
JSONDecodeError.Non-technical explanation
When the server returned an empty response under load, the client
crashed with an unhelpful
JSONDecodeError. It now retriesautomatically and, if retries are exhausted, raises a clear error
message.
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text: