镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

hyper-util: legacy client pool IdleTask spins every pool_idle_timeout when pool is empty #4100

Closed

Description

@lrowe

Version

hyper-util 0.1.17, hyper 1.6.0

Platform

Linux 6.19.10 x86_64

Summary

I noticed that Deno's event loop continued spinning every pool idle timeout even after all connections were closed (see: denoland/deno#29444). I've tracked this down to hyper-util and have a proof of concept fix to cancel the IdleTask when the pool is empty here: hyperium/hyper-util#292.

(Sorry, I did not find the contribution guidelines until after filing the draft PR.)

Code Sample

$ DENO_LOG=hyper_util::client=trace deno run --allow-net 'data:,const client = Deno.createHttpClient({ poolIdleTimeout: 100 }); const res = await fetch("http:127.0.0.1:8000/", { client }); await res.bytes(); await new Promise(resolve=>setTimeout(resolve, 2000));'
TRACE RS - hyper_util::client::legacy::pool:679 - checkout waiting for idle connection: ("http", 127.0.0.1:8000)
TRACE RS - hyper_util::client::legacy::connect::http:482 - Http::connect; scheme=Some("http"), host=Some("127.0.0.1"), port=Some(Port(8000))
DEBUG RS - hyper_util::client::legacy::connect::http:768 - connecting to 127.0.0.1:8000
DEBUG RS - hyper_util::client::legacy::connect::http:771 - connected to 127.0.0.1:8000
TRACE RS - hyper_util::client::legacy::client:575 - http1 handshake complete, spawning background dispatcher task
TRACE RS - hyper_util::client::legacy::client:600 - waiting for connection to be ready
TRACE RS - hyper_util::client::legacy::client:610 - connection is ready
TRACE RS - hyper_util::client::legacy::pool:721 - checkout dropped for ("http", 127.0.0.1:8000)
TRACE RS - hyper_util::client::legacy::pool:348 - put; add idle connection for ("http", 127.0.0.1:8000)
DEBUG RS - hyper_util::client::legacy::pool:395 - pooling idle connection for ("http", 127.0.0.1:8000)
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:492 - idle interval evicting expired for ("http", 127.0.0.1:8000)
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired
TRACE RS - hyper_util::client::legacy::pool:810 - pool closed, canceling idle interval

Expected Behavior

When the client connection pool is empty the IdleTask should not wake the event loop.

Actual Behavior

IdleTask wakes the every pool_idle_timeout ms even when empty.

Additional Context

No response

Activity

  1. added
    C-bugCategory: bug. Something is wrong. This is bad!
    on Jun 12, 2026
  2. added
    E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.
    E-pr-welcomeEffort: a pull request is welcome.
    on Aug 17, 2026
  3. Catwoman08 commented on Aug 17, 2026

    @Catwoman08
    Contributor

    Thank you for your report. This looks like something we should fix.

  4. Catwoman08 commented on Aug 31, 2026

    @Catwoman08
    Contributor

    hyperium/hyper-util#292 fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-clientArea: client.C-bugCategory: bug. Something is wrong. This is bad!E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.E-pr-welcomeEffort: a pull request is welcome.K-hyper-utilCrate: hyper-util

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions