Skip to content

fix(storage): Update offset on resumable upload retry#12086

Merged
gcf-merge-on-green[bot] merged 4 commits intogoogleapis:mainfrom
cjc25:resumable-upload-grpc-fix
May 1, 2025
Merged

fix(storage): Update offset on resumable upload retry#12086
gcf-merge-on-green[bot] merged 4 commits intogoogleapis:mainfrom
cjc25:resumable-upload-grpc-fix

Conversation

@cjc25
Copy link
Copy Markdown
Contributor

@cjc25 cjc25 commented Apr 30, 2025

When resumable uploads retry, they may observe a flush offset which is past the start of the current send (in fact the whole send might have already completed). In that case, we avoided re-sending unnecessary data, but we didn't update the offset to account for the data not sent.

When resumable uploads retry, they may observe a flush offset which is
past the start of the current send (in fact the whole send might have
already completed). In that case, we avoided re-sending unnecessary
data, but we didn't update the offset to account for the data not sent.
@cjc25 cjc25 requested review from a team April 30, 2025 15:19
@cjc25 cjc25 changed the title fix: Update offset on resumable upload retry fix(storage): Update offset on resumable upload retry Apr 30, 2025
Copy link
Copy Markdown
Contributor

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Talked with @cjc25 ; test coverage for this will come via a fix in storage-testbench.

@tritone tritone added the automerge Merge the pull request once unit tests and other checks pass. label Apr 30, 2025
@cjc25
Copy link
Copy Markdown
Contributor Author

cjc25 commented Apr 30, 2025

The test failure here is only on "earliest version" (go 1.23.6) not "latest version" (go 1.24.0):

=== RUN   TestRetryTimeoutEmulated
=== RUN   TestRetryTimeoutEmulated/grpc
    client_test.go:2228: GetBucket: got unexpected error: rpc error: code = DeadlineExceeded desc = context deadline exceeded; want 503
    client_test.go:2233: GetBucket: got unexpected error rpc error: code = DeadlineExceeded desc = context deadline exceeded, want to match DeadlineExceeded.
=== RUN   TestRetryTimeoutEmulated/http
--- FAIL: TestRetryTimeoutEmulated (0.42s)
    --- FAIL: TestRetryTimeoutEmulated/grpc (0.21s)
    --- PASS: TestRetryTimeoutEmulated/http (0.21s)

Which is... surprising :). Maybe just flaky comparison, but I don't think related to this PR. I can look later.

@tritone tritone added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 30, 2025
@tritone
Copy link
Copy Markdown
Contributor

tritone commented Apr 30, 2025

The test failure here is only on "earliest version" (go 1.23.6) not "latest version" (go 1.24.0):

=== RUN   TestRetryTimeoutEmulated
=== RUN   TestRetryTimeoutEmulated/grpc
    client_test.go:2228: GetBucket: got unexpected error: rpc error: code = DeadlineExceeded desc = context deadline exceeded; want 503
    client_test.go:2233: GetBucket: got unexpected error rpc error: code = DeadlineExceeded desc = context deadline exceeded, want to match DeadlineExceeded.
=== RUN   TestRetryTimeoutEmulated/http
--- FAIL: TestRetryTimeoutEmulated (0.42s)
    --- FAIL: TestRetryTimeoutEmulated/grpc (0.21s)
    --- PASS: TestRetryTimeoutEmulated/http (0.21s)

Which is... surprising :). Maybe just flaky comparison, but I don't think related to this PR. I can look later.

This is somewhat surprising for the emulator but might just be a flake; I triggered a rerun.

@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 30, 2025
@gcf-merge-on-green gcf-merge-on-green Bot merged commit 6ce8fe5 into googleapis:main May 1, 2025
8 checks passed
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label May 1, 2025
@cjc25
Copy link
Copy Markdown
Contributor Author

cjc25 commented May 1, 2025

The test failure here is only on "earliest version" (go 1.23.6) not "latest version" (go 1.24.0):

=== RUN   TestRetryTimeoutEmulated
=== RUN   TestRetryTimeoutEmulated/grpc
    client_test.go:2228: GetBucket: got unexpected error: rpc error: code = DeadlineExceeded desc = context deadline exceeded; want 503
    client_test.go:2233: GetBucket: got unexpected error rpc error: code = DeadlineExceeded desc = context deadline exceeded, want to match DeadlineExceeded.
=== RUN   TestRetryTimeoutEmulated/http
--- FAIL: TestRetryTimeoutEmulated (0.42s)
    --- FAIL: TestRetryTimeoutEmulated/grpc (0.21s)
    --- PASS: TestRetryTimeoutEmulated/http (0.21s)

Which is... surprising :). Maybe just flaky comparison, but I don't think related to this PR. I can look later.

This is somewhat surprising for the emulator but might just be a flake; I triggered a rerun.

The issue is that we check specifically that the error is context.DeadlineExceeded, but this is a gRPC-layer DeadlineExceeded. I don't think that can be reliable: the context deadline is propagated to the server, so now there are two clocks, and the server might return a DeadlineExceeded error before the local context is actually cancelled.

I'll send a PR to check for gRPC errors too.

@cjc25 cjc25 deleted the resumable-upload-grpc-fix branch May 1, 2025 02:22
@cjc25
Copy link
Copy Markdown
Contributor Author

cjc25 commented May 1, 2025

#12092 to fix the flake

2FaceS-bit pushed a commit to 2FaceS-bit/google-cloud-go that referenced this pull request May 12, 2025
When resumable uploads retry, they may observe a flush offset which is past the start of the current send (in fact the whole send might have already completed). In that case, we avoided re-sending unnecessary data, but we didn't update the offset to account for the data not sent.
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.

3 participants