seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.92k stars 1.12k forks source link

Requests that never end and cannot be canceled #1279

Open Yoric opened 3 years ago

Yoric commented 3 years ago

I'm submitting this issue without a minimal case so far because I have only been able to reproduce it with a specific server which requires authentication. Apologies for the lack of context. I'll try and add context as my investigation progresses.

What goes wrong

I'm using reqwest::Client::get to create and send requests to a HTTP server. According to server and proxy logs, the HTTP server sends a response within 1 second.

The first few requests work nicely. Then, for reasons that I do not understand yet, at some point all new requests:

Needless to say, this quickly brings the application to a blocking state.

I've attempted to set connection_verbose(true) and RUST_LOG=trace but I don't see any logs from reqwest for these requests.

What I'm doing specific

Software configuration

seanmonstar commented 3 years ago

That it works everywhere else but not on actix-web-actors makes me think that the issue is somewhere in there...

Something to check: in your Cargo.lock (not Cargo.toml), search for tokio. Is there only 1 version, or are there multiple?

Yoric commented 3 years ago

That it works everywhere else but not on actix-web-actors makes me think that the issue is somewhere in there...

That is also my suspicion.

Something to check: in your Cargo.lock (not Cargo.toml), search for tokio. Is there only 1 version, or are there multiple?

Only one version, 1.6.1.

Yoric commented 3 years ago

Is there any way to debug this?

Yoric commented 3 years ago

The following crates appear twice:

I wonder if it could be the double mio?

univerz commented 2 years ago

try setting pool_max_idle_per_host = 0. i have similar problem with some combination of threads, handles, spawn, buffer_unordered etc & it looks like issue is in hyper.

arthurprs commented 1 year ago

We've been hit by this yesterday (and I think once before) and tracked it down to this, which also affects reqwest. The example program from https://github.com/hyperium/hyper/issues/2312 can easily show the problem.