Skip to content

fix(storage): drain trailing EOS in gRPC Reader.Read so otelgrpc span…#14530

Open
yaruno wants to merge 2 commits intogoogleapis:mainfrom
yaruno:fix-grpc-reader-close
Open

fix(storage): drain trailing EOS in gRPC Reader.Read so otelgrpc span…#14530
yaruno wants to merge 2 commits intogoogleapis:mainfrom
yaruno:fix-grpc-reader-close

Conversation

@yaruno
Copy link
Copy Markdown

@yaruno yaruno commented May 5, 2026

closes #14470

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 5, 2026
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 5, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Read method in storage/grpc_reader.go to drain the gRPC stream when all bytes have been received, ensuring that the stream finalizes naturally and OpenTelemetry spans are not incorrectly marked as cancelled. It also adds a comprehensive set of unit tests to verify the drain logic, error handling, and idempotency. Feedback was provided to improve the robustness of the stream draining by using a loop and considering context.WithoutCancel for the cleanup process.

Comment thread storage/grpc_reader.go Outdated
@yaruno yaruno force-pushed the fix-grpc-reader-close branch from 8f6f8ff to 03fae7e Compare May 5, 2026 19:40
@yaruno yaruno marked this pull request as ready for review May 5, 2026 20:00
@yaruno yaruno requested review from a team as code owners May 5, 2026 20:00
@cpriti-os cpriti-os requested a review from krishnamd-jkp May 6, 2026 05:34
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 Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage: gRPC Reader.Close() unconditionally cancels stream context, causing otelgrpc to report successful ReadObject spans as errors

1 participant