FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: fix appendable upload finalization race condition by BenWhitehead · Pull Request #3295 · googleapis/java-storage · GitHub

fix: fix appendable upload finalization race condition - #3295

Merged
BenWhitehead merged 3 commits into
mainfrom
fix/appendable/finalize-race
Sep 16, 2025
Merged

fix: fix appendable upload finalization race condition#3295
BenWhitehead merged 3 commits into
mainfrom
fix/appendable/finalize-race

Conversation

Copy link
Copy Markdown
Collaborator

When finalizing an appendable upload depending on how quickly gcs is acking bytes, we could run into a case where finish_write: true was sent before all bytes had been enqueued.

Regression introduced in 2.57.0

When finalizing an appendable upload depending on how quickly
gcs is acking bytes, we could run into a case where finish_write: true
was sent before all bytes had been enqueued.

Regression introduced in 2.57.0
BenWhitehead requested a review from a team September 16, 2025 19:09
product-auto-label Bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels Sep 16, 2025
if (i < lastIdx && !shouldFlush) {
appended = stream.append(datum);
} else if (i == lastIdx && nextWriteShouldFinalize) {
} else if (i == lastIdx && remainingAfterPacking == 0 && nextWriteShouldFinalize) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

These two lines are the actual fix

totalSentBytes,
confirmedBytes,
size
);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Adding more info to the diagnostic to make it more useful in the future.

@Rule public final TestName testName = new TestName();

@Test
public void appendAndFinalizeOnlyPerformedIfAllBytesConsumed() throws IOException {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The new test to verify the fix

}
}

private static BidiStreamingCallable<BidiWriteObjectRequest, BidiWriteObjectResponse>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Moved into BidiUploadTestUtils.java for sharing

Copy link
Copy Markdown
Contributor

Was this caught somewhere? Is there a bug with context?

Copy link
Copy Markdown
Collaborator Author

Was this caught somewhere? Is there a bug with context?

b/445496061

ddelgrosso1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Sync'd with Ben earlier / was discussed in biweekly.

BenWhitehead merged commit 485be18 into main Sep 16, 2025
25 checks passed
BenWhitehead deleted the fix/appendable/finalize-race branch September 16, 2025 21:17
nidhiii-27 pushed a commit to nidhiii-27/java-storage that referenced this pull request Oct 6, 2025
When finalizing an appendable upload depending on how quickly
gcs is acking bytes, we could run into a case where finish_write: true
was sent before all bytes had been enqueued.

Regression introduced in 2.57.0
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
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. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL