Skip to content

HTTP/3 request fails with "error decoding response body: timeout" when fetching responses larger than ~1MB #2610

Open
@darkside1988

Description

@darkside1988

Issue Description

When using HTTP/3 to fetch responses larger than approximately 1MB in size, the request fails with a timeout error: error decoding response body: timeout.

And test files from https://sampletestfile.com/jpg/.

Reproduction Steps

  1. Create a Rust application using reqwest with HTTP/3 enabled
  2. Try to fetch a small file (~1MB) - works successfully
  3. Try to fetch a larger file (~6MB) - fails with timeout error

Code to Reproduce

fn fetch(url: &str) -> anyhow::Result<usize> {
    let client = reqwest::blocking::Client::builder()
        .http3_prior_knowledge()
        .timeout(std::time::Duration::from_secs(120))
        .build()?;
    let response = client.get(url).version(reqwest::Version::HTTP_3).send()?;
    let body = response.text()?;
    Ok(body.len())
}

fn main() {
    // This works fine (smaller file ~1.1MB)
    let url = "https://sampletestfile.com/wp-content/uploads/2023/05/1.1-MB-1.jpg";
    let size = fetch(&url).unwrap();
    println!("{}", size); // Successfully prints the size: 2168562
    
    // This fails (larger file ~6.1MB)
    let url = "https://sampletestfile.com/wp-content/uploads/2023/05/6.1-MB.jpg";
    let size = fetch(&url).unwrap(); // Panics here with error
    println!("{}", size);
}

Error Output

thread 'main' panicked at src\main.rs:17:28:
called `Result::unwrap()` on an `Err` value: error decoding response body

Caused by:
    0: request or response body error
    1: timeout

Environment

  • Operating System: Windows
  • Rust version: 1.87.0-nightly
  • reqwest version: 0.12.15

Additional Information

  • I've set a timeout of 120 seconds which should be more than enough for a ~6MB file
  • The issue seems to be related specifically to HTTP/3 since the same URLs work with HTTP/1.1 or HTTP/2
  • The failure happens consistently for files larger than approximately 1MB

Possible Causes

This could be related to:

  1. Buffer size limits in the HTTP/3 implementation
  2. Issues with QUIC flow control
  3. Configuration problems with larger HTTP/3 responses

I would appreciate any insights into this issue or potential workarounds. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-http3Area: HTTP/3C-bugCategory: bug. Something is wrong. This is bad!E-pr-welcomeThe feature is welcome to be added, instruction should be found in the issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions