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

[Feature]: Retry on HTTP2 GOAWAY frames #283

Closed
wbh1 opened this issue Dec 1, 2022 · 0 comments · Fixed by #286
Closed

[Feature]: Retry on HTTP2 GOAWAY frames #283

wbh1 opened this issue Dec 1, 2022 · 0 comments · Fixed by #286

Comments

@wbh1
Copy link
Contributor

wbh1 commented Dec 1, 2022

Description

Occasionally, we'll see errors like this when using Linode-based service discovery in Prometheus:

ts=2022-12-01T15:21:15.357Z caller=refresh.go:99 level=error component="discovery manager scrape" discovery=linode msg="Unable to refresh target groups" err="[002] http2: server sent GOAWAY and closed the connection; LastStreamID=1999, ErrCode=NO_ERR
Dec 01 10:21:15 prometheus2 prometheus[2268065]: 2022/12/01 10:21:15.357289 ERROR RESTY http2: server sent GOAWAY and closed the connection; LastStreamID=1999, ErrCode=NO_ERROR, debug="", Attempt 1

What happens is that the connection to api.linode.com gets reset because we hit the maximum number of requests for a persistent connection (e.g. nginx defaults to 1000) and the connection is closed by the server after it sends a GOAWAY. We should be able to safely retry these by opening a new connection.

There's likely more nuance to it, though. As I believe you need to validate the accompanying error with the GOAWAY frame and check on the last stream ID rather than just naively retrying every time.

Some helpful resources I've found are:

Example Code

// retries.go
func requestGOAWAYRetryCondition(_ *resty.Response, e error) bool {
	return errors.As(e, &http2.GoAwayError{})
}
jriddle-linode added a commit that referenced this issue Dec 22, 2022
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves #283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
lgarber-akamai added a commit to lgarber-akamai/linodego that referenced this issue Feb 13, 2023
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves linode#283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
lgarber-akamai added a commit to lgarber-akamai/linodego that referenced this issue Feb 13, 2023
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves linode#283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
lgarber-akamai added a commit to lgarber-akamai/linodego that referenced this issue Feb 13, 2023
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves linode#283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
lgarber-akamai added a commit to lgarber-akamai/linodego that referenced this issue Feb 14, 2023
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves linode#283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
lgarber-akamai added a commit that referenced this issue Feb 14, 2023
## 📝 Description

**What does this PR do and why is this change necessary?**

whenever resty receives a goaway frame retry.

## ✔️ How to Test

**What are the steps to reproduce the issue or verify the changes?**

`make ARGS='-run TestClient_GoAwayRetry' fixtures`

resolves #283 

Co-authored-by: Lena Garber <lgarber@akamai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant