Skip to content

HTTP/2 Adaptive Window sometimes triggers ENHANCE_YOUR_CALM #2526

@blyxxyz

Description

@blyxxyz

Downloading https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin tends to fail midway through if rustls and http2_adaptive_window are used.

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin".parse()?;
    let https = hyper_rustls::HttpsConnector::with_native_roots();
    let client: hyper::Client<_, hyper::Body> = hyper::Client::builder()
        .http2_adaptive_window(true)
        .build(https);
    let mut response = client.get(url).await?;
    hyper::body::to_bytes(response.body_mut()).await?;
    Ok(())
}
[dependencies]
hyper = { version = "0.14.7", features = ["http2"] }
hyper-rustls = "0.22.1"
tokio = { version = "1.5.0", features = ["macros", "rt-multi-thread"] }

Outputs:

Error: hyper::Error(Body, Error { kind: Io(Kind(BrokenPipe)) })

It fails consistently on my Debian machine. It fails inconsistently on @austinbutler's macOS and Arch Linux machines, see ducaale/xh#135.

I can't reproduce it when using reqwest's native-tls feature, so it's possible the real problem is somewhere in hyper-rustls or rustls itself.

I don't know if http2_adaptive_window is really vital.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions