-
Notifications
You must be signed in to change notification settings - Fork 252
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
work around hang issue in hyper #1550
Conversation
As indicated in Azure#1549, there is an issue with hyper (the underlying layer used by reqwest) that hangs in some cases on connection pools. This PR uses a commonly discussed workaround of setting `pool_max_idle_per_host` to 0. Ref: hyperium/hyper#2312
let client = ::reqwest::ClientBuilder::new() | ||
.pool_max_idle_per_host(0) | ||
.build() | ||
.expect("failed to build `reqwest` client"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I would prefer to not add expect
here, this mimics the behavior of reqwest::Client::new()
. Moving new_reqwest_client
to return a Result
cascades into extensive changes.
// | ||
// See <https://github.com/hyperium/hyper/issues/2312> for more details. | ||
let client = ::reqwest::ClientBuilder::new() | ||
.pool_max_idle_per_host(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any adverse side effects of setting this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It effectively disables connection pools. This has a performance impact but mitigates a client hang.
In addition to the original reporter, I've experienced this issue as well. It's been an open issue in the hyper repo since October 2020.
As indicated in #1549, there is an issue with hyper (the underlying layer used by reqwest) that hangs in some cases on connection pools.
This PR uses a commonly discussed workaround of setting
pool_max_idle_per_host
to 0.Ref: hyperium/hyper#2312
Mitigates #1549