Fix context.DeadlineExceeded error comparison in retry.IsTemporary #1488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the default retry predicate,
context.DeadlineExceeded
errors wrapped in a*url.Error
are misclassified as temporary and retryable due to an error equality comparison that should be anerrors.Is
.This bug results in behavior where timeouts cause the client to continue retrying (and therefore sleeping due to the retry backoff) past the client timeout. This script can be used to reproduce the issue. It simulates 5 seconds of latency on every HTTP request and a 10 second client timeout.
Output:
We see that the extra retry backoff sleeps result in a little over 4 seconds of latency past the client timeout (14.2 seconds elapsed).
If we use the code in this PR (via a
replace github.com/google/go-containerregistry v0.12.0 => github.com/ethan-lowman-dd/go-containerregistry v0.11.1-0.20221110014927-92a137e06282
directive ingo.mod
), this is the output:We now see that elapsed time is very close to the client timeout of 10 seconds.