Skip to content

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

@tomcham

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.

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