Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more generic error predicates #3116

Merged
merged 5 commits into from
Feb 13, 2020

Conversation

emilymye
Copy link
Contributor

@emilymye emilymye commented Feb 12, 2020

  • Added check for Temporary() error
  • Added check for connection reset by peer error

Fixes hashicorp/terraform-provider-google#3957

Release Note Template for Downstream PRs (will be copied)

Added retries for common network errors we've encountered.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 28 insertions(+), 4 deletions(-))
Terraform Beta: Diff ( 1 file changed, 28 insertions(+), 4 deletions(-))
TF Conversion: Diff ( 1 file changed, 28 insertions(+), 4 deletions(-))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 32 insertions(+), 4 deletions(-))
Terraform Beta: Diff ( 1 file changed, 32 insertions(+), 4 deletions(-))
TF Conversion: Diff ( 1 file changed, 32 insertions(+), 4 deletions(-))

@emilymye
Copy link
Contributor Author

reviewers - I think it's not a bad idea to add the Temporary check, but since we don't currently do this, I'm also fine removing it for now.

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just curious what would implement temporary. Is that a standard thing for temporary errors to implement, and if it is, can we link to docs or something on it from our interface?

if urlerr, ok := err.(*url.Error); ok && urlerr.Timeout() {
log.Printf("[DEBUG] Dismissed an error as retryable based on googleapis.com target: %s", err)
type temporary interface {
Temporary() bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anything implement this right now?

Copy link
Contributor Author

@emilymye emilymye Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup - url.Error and net.OpError - I actually noticed that some of the Go client libraries did this (like googleapis/google-cloud-go@8007d26)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Mind commenting and linking to an example of an implementer?

Also, I think we actually want to call Temporary(), right? Since they'll return false for non-temporary errors based on https://golang.org/src/net/net.go?s=13212:13333#L384

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i realized right after and pushed an update ha

return false, ""
}

func isRetryableUrlError(err error) (bool, string) {
Copy link
Member

@rileykarson rileykarson Feb 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) I have a slight preference for implementing this as many smaller predicates, but it isn't too strongly held.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:+1 am fine with that too. Thoughts on retrying on all net.OpErrors in general?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what the actual errors returned by that package end up looking like, if you think it would work I'm 👍. At the very least, errors for whom Temporary() and Timeout() return true make sense based on https://golang.org/src/net/net.go?s=13212:13333#L384.

@emilymye emilymye force-pushed the retryconnectionreset branch from 526c8ee to eed5d3e Compare February 13, 2020 00:30
if urlerr, ok := err.(*url.Error); ok && urlerr.Timeout() {
log.Printf("[DEBUG] Dismissed an error as retryable based on googleapis.com target: %s", err)
type temporary interface {
Temporary() bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Mind commenting and linking to an example of an implementer?

Also, I think we actually want to call Temporary(), right? Since they'll return false for non-temporary errors based on https://golang.org/src/net/net.go?s=13212:13333#L384

return false, ""
}

func isRetryableUrlError(err error) (bool, string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what the actual errors returned by that package end up looking like, if you think it would work I'm 👍. At the very least, errors for whom Temporary() and Timeout() return true make sense based on https://golang.org/src/net/net.go?s=13212:13333#L384.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))
TF Conversion: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))

1 similar comment
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))
Terraform Beta: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))
TF Conversion: Diff ( 1 file changed, 43 insertions(+), 1 deletion(-))

@emilymye emilymye force-pushed the retryconnectionreset branch from cd13777 to f0b7d22 Compare February 13, 2020 19:03
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))
TF Conversion: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))

1 similar comment
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))
TF Conversion: Diff ( 1 file changed, 57 insertions(+), 6 deletions(-))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 56 insertions(+), 6 deletions(-))
Terraform Beta: Diff ( 1 file changed, 56 insertions(+), 6 deletions(-))
TF Conversion: Diff ( 1 file changed, 56 insertions(+), 6 deletions(-))

@emilymye emilymye merged commit 4033f0b into GoogleCloudPlatform:master Feb 13, 2020
nathkn pushed a commit to nathkn/magic-modules that referenced this pull request May 18, 2020
* add connection reset by peer predicate

* lint

* separate error preds, fix temp pred

* Fix error retries, comments

* remove removed func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add retries for more network related errors
4 participants