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

Fix HTTP/2: retry requests rejected by a graceful shutdown #1425

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

seanmonstar
Copy link
Owner

When a server starts a graceful shutdown, and rejects a set of requests, those request futures would return an HTTP/2 error. This patch now inspects the error, and it is specifically an HTTP/2 graceful shutdown, and the request body can be reused, the request will be retried on a different connection. There is a limit of 2 retries just prevent possible infinite loops.

(It turns out writing a test was difficult, since hyper's graceful shutdown isn't flexible enough to select which extra requests to reject. I have verified it fixes what was reported in #1276.)

Closes #1276

@seanmonstar seanmonstar force-pushed the http2-retry-graceful-shutdown branch from 5242893 to 8f1f8d5 Compare January 7, 2022 18:22
@seanmonstar seanmonstar force-pushed the http2-retry-graceful-shutdown branch from 8f1f8d5 to 9c4b4fb Compare January 7, 2022 18:24
@seanmonstar
Copy link
Owner Author

cc @ry @lucacasonato

@seanmonstar seanmonstar merged commit a03ca50 into master Jan 7, 2022
@seanmonstar seanmonstar deleted the http2-retry-graceful-shutdown branch January 7, 2022 19:04
@lucacasonato
Copy link

This is great Sean, thanks so much for working on this! I have confirmed that this fixes the issue we were running into (at least judging by all of our isolated test cases). I will try it out in production right after this lands in a new reqwest release.

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 this pull request may close these issues.

bug: connection pooling on http/2 breaks with high concurrency
2 participants