Skip to content
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
wants to merge 3 commits into from

Conversation

ttimonen
Copy link
Contributor

@ttimonen ttimonen commented Apr 5, 2023

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

  • Bug Fix (non-breaking fixes to existing functionality)
  • Test Updates

Test Information

  • My PR required test updates

Go Version: 1.20.3
Os Version: macOS Ventura 13.2.1
OpenAPI Spec Version: 2.15.0

Signoff

  • I have submitted a CLA for this PR
  • Each commit message explains what the commit does
  • I have updated documentation to explain what my PR does
  • My code is covered by tests if required
  • I ran make fmt on my code
  • I did not edit any automatically generated files

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 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
Copy link
Collaborator

monde commented 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

MikeMondragon-okta pushed a commit that referenced this pull request Apr 12, 2023
@monde monde mentioned this pull request Apr 12, 2023
@monde monde closed this in #372 Apr 12, 2023
monde added a commit that referenced this pull request Apr 12, 2023
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ListApplications function doesn't return apps in first page
3 participants