Open wric opened 9 months ago
This is very strange indeed, can you double check if this was not some temporary failure? If not, can you share the OS that you are using inside WSL (Ubuntu 20.04, 22.04,...)?
Issue persists today. I even rebooted the computer haha.
Static hostname: DESKTOP-XXXX
Icon name: computer-container
Chassis: container
Machine ID: 14afXXXX
Boot ID: d9cfXXXX
Virtualization: wsl
Operating System: Ubuntu 22.04.3 LTS
Kernel: Linux 5.15.133.1-microsoft-standard-WSL2
Architecture: x86-64
(XXXXs are mine. I have no idea if the id:s are sensible info).
I will try to update Ubuntu and get back.
Static hostname: DESKTOP-XXXX
Icon name: computer-container
Chassis: container ☐
Machine ID: 14afXXXX
Boot ID: be75XXXX
Virtualization: wsl
Operating System: Ubuntu 23.04
Kernel: Linux 5.15.133.1-microsoft-standard-WSL2
Architecture: x86-64
Unfortunately sill NetworkError
. Also tested with both roc dev
and roc run
, same issue.
Thanks for the info @wric, I'll try to reproduce.
I was able to reproduce the issue, going to dig into it now...
Surprisingly, this does not reproduce on Ubuntu 22.04 native (not inside WSL).
When building with the platform locally (packages { pf: "../src/main.roc" }
) the issue reproduces when using export CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
.
Also got some more detail on the error:
[src/lib.rs:638] &res = Err(
hyper::Error(
Connect,
ConnectError(
"dns error",
Custom {
kind: Uncategorized,
error: "failed to lookup address information: Name does not resolve",
},
),
),
)
I'm done for today, but tomorrow I'm going to try to reproduce this with a pure rust program.
I was able to reproduce this with pure rust: Cargo.toml:
name = "rusttemp"
version = "0.1.0"
edition = "2021"
[dependencies]
hyper = { version = "=0.14.27", default-features = false, features = ["http1", "client"] }
hyper-rustls = { version = "=0.24.2", default-features = false, features = ["http1", "tls12", "native-tokio"]}
tokio = { version = "=1.31.0", default-features = false}
src/main.rs:
fn main() {
testrequest();
println!("Done");
}
fn testrequest() {
use hyper::Client;
use hyper_rustls::HttpsConnectorBuilder;
let https = HttpsConnectorBuilder::new()
.with_native_roots()
.https_or_http()
.enable_http1()
.build();
let client: Client<_, hyper::Body> = Client::builder().build(https);
let method = hyper::Method::GET;
let url = "https://api-extern.systembolaget.se/site/V2/Search/Site";
let mut req_builder = hyper::Request::builder().method(method).uri(url);
let body_bytes = vec![];
let request = req_builder.body(body_bytes.into()).unwrap();
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.enable_time()
.build()
.unwrap();
let http_fn = async {
let res = client.request(request).await;
dbg!(&res);
};
rt.block_on(http_fn);
}
Analyzing the packets with tshark shows identical (normal) DNS responses for the working vs the broken rust app.
Trying to circumvent dns by adding to 20.107.9.198 api-extern.systembolaget.se
etc/hosts
fixes the Network Error
.
I'm now trying to upgrade the rust example to hyper v1. Upgrading may make the problem disappear, v1 also added tracing, so it can also make debugging easier.
I have this minimal reproducing example with a basic GET to a specific API:
On Apple silicon it works as expected (no credentials passed, hence 401):
But on my Windows machine running WSL2 it returns
NetworkError
:However, querying other API:s such as
https://catfact.ninja/fact
work well on WSL2 with the same example code. Also, cloning this repo and importing the platform aspackages { pf: "../src/main.roc" }
works with the troublesome API.Any idea of why, or any suggestions on how to further debug?