Skip to content

Remove the per-rpc timeout in cachetools.GetBlob#11369

Merged
vanja-p merged 1 commit intomasterfrom
vanja--timeout
Feb 23, 2026
Merged

Remove the per-rpc timeout in cachetools.GetBlob#11369
vanja-p merged 1 commit intomasterfrom
vanja--timeout

Conversation

@vanja-p
Copy link
Contributor

@vanja-p vanja-p commented Feb 20, 2026

This per-rpc timeout was only applied in the retriable case, which became more common after #9860.

We already enforce a timeout on each stream.Recv call, and it doesn't make sense to enforce the same timeout on the overall RPC. Also, it's difficult to pick a timeout for the whole streaming RPC, because the time depends directly on the size of the blob. We could scale the timeout with the size of the resource (something like 1 second for each 100KB), but that seems pretty finicky.

Also, we're not setting a per-RPC deadline for bytestream.Write calls in cachetools.UploadFromReaderWithCompression.

This per-rpc timeout was only applied in the retriable case, which became more common after #9860.

We already enforce a timeout on each `stream.Recv` call, and it doesn't make sense to enforce the same timeout on the overall RPC. Also, it's difficult to pick a timeout for the whole streaming RPC, because the time depends directly on the size of the blob. We could scale the timeout with the size of the resource (something like 1 second for each 100KB), but that seems pretty finicky.

Also, we're not setting a per-RPC deadline for `bytestream.Write` calls in `cachetools.UploadFromReaderWithCompression`.
Copy link
Member

@bduffany bduffany left a comment

Choose a reason for hiding this comment

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

If I understand the code correctly we have a timeout on each Recv but not the initial Read() call, so this change effectively removes the timeout on the initial Read? could that be problematic?

@vanja-p
Copy link
Contributor Author

vanja-p commented Feb 20, 2026

If I understand the code correctly we have a timeout on each Recv but not the initial Read() call, so this change effectively removes the timeout on the initial Read? could that be problematic?

Yeah, the initial Read call could block indefinitely, though the same is true with the Write call in uploadFromReader, and the same is still true for non-seeker calls to cachetools.GetBlob.

@vanja-p vanja-p requested a review from bduffany February 20, 2026 21:12
@vanja-p vanja-p merged commit 79b3691 into master Feb 23, 2026
9 of 13 checks passed
@vanja-p vanja-p deleted the vanja--timeout branch February 23, 2026 19:35
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.

3 participants