-
Notifications
You must be signed in to change notification settings - Fork 433
fix(storage): fixing flushing and finalization in buffered upload of async client #15572
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
Merged
shubham-up-47
merged 10 commits into
googleapis:main
from
shubham-up-47:fixing_buffered_upload
Oct 9, 2025
Merged
fix(storage): fixing flushing and finalization in buffered upload of async client #15572
shubham-up-47
merged 10 commits into
googleapis:main
from
shubham-up-47:fixing_buffered_upload
Oct 9, 2025
Conversation
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15572 +/- ##
========================================
Coverage 93.09% 93.10%
========================================
Files 2418 2418
Lines 221886 222282 +396
========================================
+ Hits 206569 206949 +380
- Misses 15317 15333 +16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
v-pratap
reviewed
Oct 8, 2025
v-pratap
previously approved these changes
Oct 8, 2025
scotthart
reviewed
Oct 8, 2025
google/cloud/storage/internal/async/writer_connection_buffered.cc
Outdated
Show resolved
Hide resolved
scotthart
previously approved these changes
Oct 8, 2025
scotthart
approved these changes
Oct 8, 2025
v-pratap
approved these changes
Oct 9, 2025
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.
This PR refactors AsyncWriterConnectionBuffered to fix critical bugs in its resume and finalization logic, which were discovered while updating integration tests where a final Flush was not happening during finalization, that time a temporary fix was done. These changes are totally inspired by the PR #15114 making the component significantly more reliable.
The original implementation was just calling Write() during Flush() and contained subtle flaws in its state machine when handling a Finalize() failure. This could lead to incorrect state transitions during a resume, or deadlocks where pending Flush calls would hang indefinitely during race conditions with SetFinalized. The fix introduces a distinct implementation for Flush() with its own promise queue to ensure a reliable completion signal. To correct the resume behavior, OnFinalize is modified to preserve the finalizing_ state, and OnResume is updated to use the new connection immediately, preventing incorrect retries. The idempotency guard in SetFinalized now correctly drains the flush queue to prevent hangs.
This change is