Skip to content

[9.3.0] remote: add gRPC download idle timeout - #30667

Merged
iancha1992 merged 3 commits into
bazelbuild:release-9.3.0from
sluongng:sluongng/cherrypick-29916-9.3.0
Sep 1, 2026
Merged

[9.3.0] remote: add gRPC download idle timeout#30667
iancha1992 merged 3 commits into
bazelbuild:release-9.3.0from
sluongng:sluongng/cherrypick-29916-9.3.0

Conversation

@sluongng

@sluongng sluongng commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The gRPC service-config support from #29912 is now on master. It lets users lengthen the whole-call deadline for ByteStream.Read so large downloads can keep running while they make progress. A longer deadline also lets a stalled stream wait just as long, because a total RPC deadline cannot distinguish progress from inactivity.

This adds --remote_grpc_download_idle_timeout as an independent inactivity limit for ByteStream.Read. It defaults to 60 seconds to match the existing HTTP remote-cache default; setting it to 0 disables it. When a read goes idle, Bazel cancels it and translates the timeout-owned CANCELLED closure to DEADLINE_EXCEEDED so the normal cache retrier can resume from the received offset. Other RPCs, including ByteStream.Write, Execute, and WaitExecution, are unaffected.

Timeout tracking uses a monotonic deadline and at most one scheduled task per call. This avoids retaining a canceled task for every response and prevents a timer from canceling a read that has since made progress. Normal gRPC forwarding stays in finally blocks so timeout bookkeeping failures cannot suppress messages or callbacks.

Tests cover:

  • the 60-second option default and exclusion of ByteStream.Write;
  • cancellation status and single-task scheduling as reads make progress;
  • request and response forwarding when timeout bookkeeping fails; and
  • an in-process ByteStream flow that sends a prefix, stalls, fires the timeout deterministically, and verifies that the retry resumes from the next offset.

The interceptor currently applies only to ByteStream.Read. The download-specific option name leaves room to cover future server-streaming download RPCs such as SplitChunks without implying that every remote stream should share this timeout.

Cherry-pick of #29916. Stacked on #30666, which backports #29912.

@sluongng
sluongng force-pushed the sluongng/cherrypick-29916-9.3.0 branch from 96bd345 to 32ea41e Compare August 11, 2026 12:46
@iancha1992 iancha1992 changed the title remote: add gRPC download idle timeout [9.3.0] remote: add gRPC download idle timeout Aug 12, 2026
@iancha1992
iancha1992 requested a review from coeuvre August 13, 2026 21:47
@iancha1992 iancha1992 added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Aug 13, 2026
@iancha1992

Copy link
Copy Markdown
Member

@sluongng Is this ready for review?

@sluongng

Copy link
Copy Markdown
Contributor Author

it is, but it's based on #30666 so i was hoping to get that one merged first.

i will just flip the switch anyway then

@sluongng
sluongng marked this pull request as ready for review August 14, 2026 09:11
@sluongng
sluongng requested a review from a team as a code owner August 14, 2026 09:11
@github-actions github-actions Bot added the team-Core Skyframe, bazel query, BEP, options parsing, bazelrc label Aug 14, 2026
@iancha1992
iancha1992 enabled auto-merge August 14, 2026 18:18
@iancha1992

Copy link
Copy Markdown
Member

@sluongng I think this one is now ready to merge. Could you please resolve the conflicts?

auto-merge was automatically disabled August 18, 2026 23:07

Head branch was pushed to by a user without write access

@sluongng
sluongng force-pushed the sluongng/cherrypick-29916-9.3.0 branch from b2aafe3 to 9ff3fd5 Compare August 18, 2026 23:07
The gRPC service-config support from bazelbuild#29912 is now on master. It lets users lengthen the whole-call deadline for `ByteStream.Read` so large downloads can keep running while they make progress. A longer deadline also lets a stalled stream wait just as long, because a total RPC deadline cannot distinguish progress from inactivity.

This adds `--remote_grpc_download_idle_timeout` as an independent inactivity limit for `ByteStream.Read`. It defaults to 60 seconds to match the existing HTTP remote-cache default; setting it to `0` disables it. When a read goes idle, Bazel cancels it and translates the timeout-owned `CANCELLED` closure to `DEADLINE_EXCEEDED` so the normal cache retrier can resume from the received offset. Other RPCs, including `ByteStream.Write`, `Execute`, and `WaitExecution`, are unaffected.

Timeout tracking uses a monotonic deadline and at most one scheduled task per call. This avoids retaining a canceled task for every response and prevents a timer from canceling a read that has since made progress. Normal gRPC forwarding stays in `finally` blocks so timeout bookkeeping failures cannot suppress messages or callbacks.

Tests cover:

- the 60-second option default and exclusion of `ByteStream.Write`;
- cancellation status and single-task scheduling as reads make progress;
- request and response forwarding when timeout bookkeeping fails; and
- an in-process `ByteStream` flow that sends a prefix, stalls, fires the timeout deterministically, and verifies that the retry resumes from the next offset.

The interceptor currently applies only to `ByteStream.Read`. The download-specific option name leaves room to cover future server-streaming download RPCs such as [`SplitChunks`](bazelbuild/remote-apis#377) without implying that every remote stream should share this timeout.

Closes bazelbuild#29916.

PiperOrigin-RevId: 956359263
Change-Id: Id8ae7c6dbb172f1e7e799536193458d9cbfb8c0c
(cherry picked from commit 6e27dd1)
@sluongng
sluongng force-pushed the sluongng/cherrypick-29916-9.3.0 branch from 9ff3fd5 to 73f950e Compare August 18, 2026 23:45
@iancha1992
iancha1992 enabled auto-merge August 19, 2026 17:46
@iancha1992
iancha1992 added this pull request to the merge queue Aug 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 28, 2026
@iancha1992
iancha1992 enabled auto-merge August 28, 2026 18:05
@iancha1992
iancha1992 added this pull request to the merge queue Aug 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 28, 2026
@iancha1992
iancha1992 added this pull request to the merge queue Aug 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 31, 2026
@iancha1992
iancha1992 added this pull request to the merge queue Aug 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 31, 2026
@iancha1992
iancha1992 added this pull request to the merge queue Sep 1, 2026
Merged via the queue into bazelbuild:release-9.3.0 with commit b70d867 Sep 1, 2026
41 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants