-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle network errors and don't cancel context in request before reading response #369
Closed
Conversation
This file contains 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
This changes the doWithRetries to return a cleanup func to be called once the response is read instead of taking it down prematurely. This becomes an issue with large requests where there's a packet boundary between received headers and rest of the body.
In particular, do check that we have the context available when reading the response.
Previously we got partial results instead, and we were having this happening silently. If we were lucky, the json parsing failed though.
ttimonen
changed the title
Don't cancel context in request before reading response
Handle network errors and don't cancel context in request before reading response
Apr 11, 2023
monde
approved these changes
Apr 12, 2023
I approve this PR. Our CI guards against external PRs running so we'll have to make an Okta branch and cherry pick this in. Thanks @ttimonen |
duytiennguyen-okta
approved these changes
Apr 12, 2023
Merged
monde
added a commit
that referenced
this pull request
Apr 12, 2023
12 tasks
mdwn
pushed a commit
to gravitational/teleport
that referenced
this pull request
Sep 29, 2023
Fixes unexpected EOF responses seen when the Okta service attempts to interact with the Okta API. This only affects v13, as v14 and master are both running v2.20.0 already. okta/okta-sdk-golang#363 is an issue filed against the Okta Go SDK where some API calls were seeing empty responses or unexpected EOFs for larger responses. okta/okta-sdk-golang#369 was submitted to fix this, and then was pulled in as part of okta/okta-sdk-golang#372.
github-merge-queue bot
pushed a commit
to gravitational/teleport
that referenced
this pull request
Sep 29, 2023
Fixes unexpected EOF responses seen when the Okta service attempts to interact with the Okta API. This only affects v13, as v14 and master are both running v2.20.0 already. okta/okta-sdk-golang#363 is an issue filed against the Okta Go SDK where some API calls were seeing empty responses or unexpected EOFs for larger responses. okta/okta-sdk-golang#369 was submitted to fix this, and then was pulled in as part of okta/okta-sdk-golang#372.
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.
Summary
This changes the doWithRetries to return a cleanup func to be called once the response is read instead of taking it down prematurely. Also, and maybe more importantly: Report network errors instead of silently ignoring them and processing partial data.
This becomes an issue with large requests where there's a packet boundary between received headers and rest of the body.
Fixes #363
Type of PR
Test Information
Go Version: 1.20.3
Os Version: macOS Ventura 13.2.1
OpenAPI Spec Version: 2.15.0
Signoff
make fmt
on my code