Environment details
- Programming language: Go
- OS: Linux
- Language runtime version: 1.18.5
- Package version:
google.golang.org/api v0.66.0 and cloud.google.com/go/storage v1.19.0
Steps to reproduce
- Run an idempotent operation like this (creating a file in GCS):
bkt.Object(dstPath).If(storage.Conditions{DoesNotExist: true}).NewWriter(ctx).Write(b)
- Make the server return a 503, causing the underlying call of
sendAndRetry() to fail and block until it's time for a second attempt.
- Cancel
ctx before the second attempt.
- Observe that the error returned by
.Write() will contain the 503 error message but not context.Canceled.
This is misleading because it makes it look like the error that caused the operation to fail and return was the 503 error from the server, but what actually caused the operation to fail and return was my code canceling the context. This is confusing because the docs tell you that the library will retry idempotent operations upon 503, so it's really weird seeing the operation return the 503 error.
Environment details
google.golang.org/api v0.66.0andcloud.google.com/go/storage v1.19.0Steps to reproduce
bkt.Object(dstPath).If(storage.Conditions{DoesNotExist: true}).NewWriter(ctx).Write(b)sendAndRetry()to fail and block until it's time for a second attempt.ctxbefore the second attempt..Write()will contain the 503 error message but notcontext.Canceled.This is misleading because it makes it look like the error that caused the operation to fail and return was the 503 error from the server, but what actually caused the operation to fail and return was my code canceling the context. This is confusing because the docs tell you that the library will retry idempotent operations upon 503, so it's really weird seeing the operation return the 503 error.