Skip to content

feat: adding read stall retry for gRPC storage client#20169

Draft
raj-prince wants to merge 7 commits into
googleapis:mainfrom
raj-prince:grpc_read_stall
Draft

feat: adding read stall retry for gRPC storage client#20169
raj-prince wants to merge 7 commits into
googleapis:mainfrom
raj-prince:grpc_read_stall

Conversation

@raj-prince

@raj-prince raj-prince commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Extending the dynamic delay algorithm and stall retry mechanism (previously HTTP XML only) to support gRPC read operations. At high level changes includes:

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds support for dynamic read stall timeouts to the gRPC API, bringing feature parity with the XML API. It introduces a bucketDelayManager to track latencies and dynamically adjust timeouts, and adds emulator tests to verify the behavior. The review feedback highlights two main issues: first, using time.After in request-scoped paths can cause temporary memory leaks, so it should be replaced with time.NewTimer and stopped via defer timer.Stop(). Second, the dynamic stall timeout should not be increased if the outer context was cancelled by the caller, which can be prevented by checking ctx.Err() == nil before calling increase().

Comment thread storage/grpc_client.go Outdated
Comment thread storage/grpc_client.go Outdated
Comment thread storage/grpc_reader.go Outdated
Comment thread storage/grpc_reader.go Outdated
@raj-prince raj-prince changed the title feat: adding read stall support for gRPC feat: adding read stall retry for gRPC storage client Jul 16, 2026
@raj-prince
raj-prince marked this pull request as ready for review July 16, 2026 15:18
@raj-prince
raj-prince requested review from a team as code owners July 16, 2026 15:18
@raj-prince
raj-prince marked this pull request as draft July 21, 2026 03:00
Comment thread storage/dynamic_delay.go Outdated
Comment thread storage/dynamic_delay.go
}

// executeWithReadStallTimeout executes openStream with dynamic delay stall retry tracking.
func executeWithReadStallTimeout(

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.

Why can't this be a method on the struct only instead of passing bucketDelayManager again into this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My main motivation for keeping executeWithReadStallTimeout as a standalone helper function is to maintain a clear separation of concerns:

  • bucketDelayManager acts as a pure statistics/delay calculator.
  • executeWithReadStallTimeout handles concurrency orchestration (context cancellation, timers, and callbacks).
    Keeping execution flow decoupled from data management prevents bucketDelayManager from becoming tightly coupled to gRPC/HTTP stream lifecycle management.

Happy to refactor if you still prefer having it as a method on bucketDelayManager!"

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.

2 participants