remote: add download idle timeout#29916
Open
sluongng wants to merge 4 commits into
Open
Conversation
coeuvre
requested changes
Jun 25, 2026
Remote cache users need a path to per-RPC timeout policy, but Bazel currently applies --remote_timeout by setting deadlines directly on individual remote stubs. This change is needed so timeout policy can move to one channel-level mechanism before any new user-facing knob is added. Generate an equivalent service config from the existing remote timeout setting and install it on remote gRPC channels. This preserves the current user-facing flag while moving timeout configuration to the same mechanism that later changes can extend for per-RPC policy.
Remote cache users need finer timeout control than the single --remote_timeout value can express. This change lets advanced users provide a restricted gRPC service config file with timeout values for specific remote RPCs. Only the documented timeout subset is supported initially. Bazel can expand the accepted service config surface later without treating retry, hedging, load balancing, or health-checking behavior as stable today.
The existing remote timeout applies to whole RPCs. That is awkward for large downloads because a healthy ByteStream.Read can take longer than short metadata calls, while a stuck read should still be retried quickly after response data stops arriving. Add --remote_download_idle_timeout for ByteStream.Read. When non-zero, Bazel cancels the read if no response data arrives within the configured duration, allowing the normal retrier to issue a new request. Scope this to downloads rather than all streaming RPCs so long-running Execute/WaitExecution streams and ByteStream writes keep their existing deadline behavior. The download-specific name also leaves room for future server-streamed download RPCs such as SplitChunks, without implying that all remote streams should use this timeout.
Coeuvre requested two changes on PR bazelbuild#29916 because the new idle timeout only applies to gRPC downloads, and callback forwarding should not be skipped if timeout bookkeeping throws. Rename the option to --remote_grpc_download_idle_timeout and wrap the forwarding points in finally blocks. The rebase onto current master also exposed two ByteStreamUploaderTest calls that still passed the removed callTimeoutSecs parameter. Drop that stale argument so the remote test target compiles against the rebased uploader constructor.
f43b752 to
50f6aa8
Compare
Contributor
Author
|
I will rebase + review this PR once more after #29912 is merged. Currently, it would be a pain having to rebase 2 PRs and trigger CI for each round of review. |
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
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.
Stacked on #29912.
The existing remote timeout applies to whole RPCs. That is awkward for large downloads because a healthy ByteStream.Read can take longer than short metadata calls, while a stuck read should still be retried quickly after response data stops arriving.
Add --remote_download_idle_timeout for ByteStream.Read. When non-zero, Bazel cancels the read if no response data arrives within the configured duration, allowing the normal retrier to issue a new request. Scope this to downloads rather than all streaming RPCs so long-running Execute/WaitExecution streams and ByteStream writes keep their existing deadline behavior.
ByteStream.Read is the only affected RPC today. The download-specific name leaves room to cover other server-streaming download RPCs in the future, such as SplitChunks from bazelbuild/remote-apis#377, without implying that all remote streams should use this timeout.