Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Stream reset on retry #284

@fboismenu

Description

@fboismenu

Hello there,

I am using the library, indirectly via python-storage, in maybe an unorthodox way: I am trying to implement a download timeout via a custom http adapter and response.
So my response object is throwing pro-actively timeouts (common.InvalidResponse with http.client.REQUEST_TIMEOUT),
which is forcibly triggering the retry logic in the Download class:

All goes well, but one thing: the final results content data from both the partial content of prematurely aborted request and the final and complete data of the second request.
It happens because both dataset are accumulated in the _stream above.

Do you agree it's bug and that on retry the _stream shall be resetted (e.g. seek(0))? Do I miss a use case where it makes sense to accumulated data, or we were just assuming data would be empty anyway on exception?

If I did not miss anything I'll submit a PR to fix it.

Many thanks in advance.
Fred

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/google-resumable-media-python API.priority: p2Moderately-important priority. Fix may not be included in next release.status: investigatingThe issue is under investigation, which is determined to be non-trivial.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions