Hyper client does not clean up idle connections with non-tokio executor
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
Version
Hyper 0.13.10
Platform
The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
Fuchsia, as well as on Linux and OS-X
Description
Fuchsia uses hyper as our http client in a few places. Inside the Fuchsia operating system, we use a Fuchsia-specific executor. Our host-side development tools also use async-executor instead of tokio. Because of this, we've discovered that our client connection pool is not closing idle connections. This is because the pool implementation only runs the periodic idle connection cleaner if the runtime feature, which pulls in tokio, is enabled:
https://github.com/hyperium/hyper/blob/master/src/client/pool.rs#L385
We'd be happy to work around this on our side, but unfortunately hyper doesn't expose the pool implementation, or any method to remove idle connections.
One possible way we could support this is to add a function Client::close_idle_connections(), which under the covers calls PoolInner::clear_expired. We could set up a task using our timer interfaces to periodically close these connections. Would you be interested in patch that implements this? Or would you prefer a separate mechanism to expose this functionality?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/client/pool.rs around the runtime-gated idle cleaner and PoolInner::clear_expired. Compare the proposed Client::close_idle_connections API with the existing pool behavior and determine how a non-tokio executor could trigger cleanup; done means idle connections can be closed without requiring the runtime feature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100