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

fix: update retry handling to retry idempotent requests that encounter unexpected EOF while parsing json responses #1155

Merged
merged 2 commits into from Dec 13, 2021

Conversation

BenWhitehead
Copy link
Collaborator

Fix

Update DefaultStorageRetryStrategy to account for EOF errors from Json. When parsing json it's possible we've only received a partial document and parsing will fail. If an unexpected EOF happens from parsing and the request is idempotent retry it.

Tests

Add two new integration tests which leverage the testbench to force the EOF to happen upon the completion of the resumable session.

  • Add 0B offset test
  • Add 10B offset test

Add new cases to DefaultRetryHandlingBehaviorTest to ensure continued expected handling for the new EOF behavior.

Refactor

  • Make TestBench.java (and its associated Builder) public to allow for use outside the retry conformance test package
  • Create new JUnit @rule DataGeneration moving com.google.cloud.storage.it.ITStorageTest#randString to it and change the signature to produce a ByteBuffer rather than a string. (this should simplify use since the strings returned were immediately turned to bytes)

Fixes #1154

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage API. label Nov 22, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 22, 2021
@BenWhitehead
Copy link
Collaborator Author

Blocked until the release of googleapis/storage-testbench#169

@frankyn
Copy link
Member

frankyn commented Dec 2, 2021

Updated testbench name for broken stream after resumable upload completes. PTAL: googleapis/storage-testbench#169

…r unexpected EOF while parsing json responses

### Fix
Update DefaultStorageRetryStrategy to account for EOF errors from Json. When parsing json it's possible we've only received a partial document and parsing will fail. If an unexpected EOF happens from parsing and the request is idempotent retry it.

#### Tests
Add two new integration tests which leverage the testbench to force the EOF to happen upon the completion of the resumable session.
* Add 0B offset test
* Add 10B offset test

Add new cases to DefaultRetryHandlingBehaviorTest to ensure continued expected handling for the new EOF behavior.

#### Refactor
* Make TestBench.java (and its associated Builder) public to allow for use outside the retry conformance test package
* Create new JUnit @rule DataGeneration moving com.google.cloud.storage.it.ITStorageTest#randString to it and change the signature to produce a ByteBuffer rather than a string. (this should simplify use since the strings returned were immediately turned to bytes)

Fixes #1154

deps: update storage-testbench to v0.10.0
@BenWhitehead BenWhitehead marked this pull request as ready for review December 8, 2021 18:11
@BenWhitehead BenWhitehead requested review from a team as code owners December 8, 2021 18:11
return new Builder();
}

static final class RetryTestResource {
public static final class RetryTestResource {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being set to public now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it can be used outside of the retry package in the IT package where I added the new test

@BenWhitehead BenWhitehead added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 13, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 13, 2021
@BenWhitehead BenWhitehead added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 13, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 13, 2021
@BenWhitehead BenWhitehead merged commit 8fbe6ef into googleapis:main Dec 13, 2021
@BenWhitehead BenWhitehead deleted the retry-json-eof branch December 13, 2021 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

storage.writer(...) does not automatically retry unexpected EOF when parsing json for an idempotent session.
3 participants