actix / actix/actix-web

[Windows] Web Client is unreasonably slow

Offen
#2,256 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

Reproduce snippet:
```rust
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let sys_time = std::time::SystemTime::now();
let start_time = sys_time.elapsed().unwrap();

let client = actix_web::client::Client::builder()
.connector(actix_web::client::Connector::new()
.timeout(Duration::from_secs(35))
.finish())
.timeout(Duration::from_secs(35))
.finish();

let response = client.get("https://google.com")
.send()
.await
.unwrap()
.body()
.await
.unwrap();
let end_time = sys_time.elapsed().unwrap();
let secs = end_time - start_time;
println!("{}", secs.as_secs());
return Ok(());
}
```

This code prints "20" on Windows, i.e. get request to Google takes 20 seconds.

Same code on Linux (WSL2) takes 0 seconds.

I don't have any clues what might be wrong, but perhaps it's related to DNS resolution?

`Cargo.toml`:
```toml
// ...

[dependencies]
actix-web = { version = "3", features = ["rustls"] }
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the Rust client code in the reproduction and the actix-web version 3 dependency in Cargo.toml. Run the snippet on Windows and Linux/WSL2, then investigate the request path and DNS-resolution hypothesis. Done means the same Google request no longer takes about 20 seconds on Windows and the behavior is covered by an appropriate regression test.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.