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

HttpStorageRpc#getCurrentUploadOffset uses 0 as error code in StorageException #687

Description

@tomcham

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please include as much information as possible:

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types
  2. OS type and version:
  3. Java version: 1.8.x
  4. storage version(s): 1.113.9

Steps to reproduce

Code example

// example

Stack trace

c.g.c.s.StorageException: Not sure what occurred. Here's debugging information:
Response:
com.google.api.client.http.HttpResponseException: 503 Service Unavailable
PUT https://storage.googleapis.com/upload/storage/v1/b/.../o?name=...&uploadType=resumable&upload_id=...


	at c.g.c.s.s.v.HttpStorageRpc.getCurrentUploadOffset(HttpStorageRpc.java:790) ~[google-cloud-storage-1.113.9.jar:1.113.9]
	at c.g.c.s.BlobWriteChannel$1.run(BlobWriteChannel.java:133)
	at j.u.c.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_181]
	at c.g.a.g.r.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105) ~[gax-1.60.1.jar:1.60.1]
	at c.g.c.RetryHelper.run(RetryHelper.java:76) ~[google-cloud-core-1.94.0.jar:1.94.0]
	at c.g.c.RetryHelper.runWithRetries(RetryHelper.java:50)
	at c.g.c.s.BlobWriteChannel.flushBuffer(BlobWriteChannel.java:70) ~[google-cloud-storage-1.113.9.jar:1.113.9]
	at c.g.c.BaseWriteChannel.close(BaseWriteChannel.java:151) ~[google-cloud-core-1.94.0.jar:1.94.0]
	at j.n.c.Channels$1.close(Channels.java:178) ~[na:1.8.0_181]

External references such as API reference guides

Any additional information below

I am using https://github.com/googleapis/java-storage/blob/v1.113.9/google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java#L2673 to stream uploads.

Occasionally 503 response code is returned when executing https://github.com/googleapis/java-storage/blob/v1.113.9/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java#L752 and 0 is used as the error code when throwing a StorageException. If I understand correctly the error code is used to determine when to retry and 0 is not part of the retry-able error codes (https://github.com/googleapis/java-storage/blob/v1.113.9/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageException.java#L40), but in this case we should retry 503s.

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Jan 21, 2021
  2. tomcham commented on Feb 18, 2021

    @tomcham
    Author

    Hello, @frankyn any estimated time when this will be fixed?

  3. self-assigned this
    on Feb 18, 2021
  4. frankyn commented on Feb 18, 2021

    @frankyn
    Contributor

    Hi @tomcham,

    Thanks for the ping, the error code 0 is to prevent retries in this case, but looks like we need to add retries to the getCurrentUploadOffset which was not how it's implemented.

    Thanks for raising this issue, I'll work to get this fixed within the next week.

  5. frankyn commented on Mar 2, 2021

    @frankyn
    Contributor

    The fix was released in version 1.113.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/java-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.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