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

work around hang issue in hyper #1550

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

demoray
Copy link
Contributor

@demoray demoray commented Jan 5, 2024

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

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
@demoray demoray linked an issue Jan 5, 2024 that may be closed by this pull request
let client = ::reqwest::ClientBuilder::new()
.pool_max_idle_per_host(0)
.build()
.expect("failed to build `reqwest` client");
Copy link
Contributor Author

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.

https://github.com/seanmonstar/reqwest/blob/4f54ba732f80ccb89e50954a369d6e8bb46375f2/src/async_impl/client.rs#L1672-L1674

//
// See <https://github.com/hyperium/hyper/issues/2312> for more details.
let client = ::reqwest::ClientBuilder::new()
.pool_max_idle_per_host(0)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

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.

Hyper client hang in container
3 participants