-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"nodename nor servname provided, or not known" when trying to connect to google.com on MacOS #1285
Comments
In the example you posted, there's 4 "w"s instead of the normal 3 "www". Could that be it? |
Apologies for that mistake, but sadly no ,that is not the error |
That does sound like a setup issue. Here's a simpler program using just libstd, which is essentially how reqwest is looking up DNS: use std::net::ToSocketAddrs;
fn main() {
let _ = dbg!(("www.google.com", 80).to_socket_addrs());
} |
I'm running into this same problem, but only intermittently (after running for several minutes or even hours) where I'm pinging the same URL every several minutes. I'm running macOS 13.1. In my case I'm wondering if I should be using some additional error handling and retrying when this occurs? |
This seems to happen when there are too many lookups say in a loop. If you resolve the domain once and use the ip from the resolution in the requests things seems to work just fine |
That makes sense. Is there a pattern for doing so? Since I'm using |
@maxcountryman before the loop I just get the addresses using to_socket_addrs and get the first ipv4 from the iter returned from |
I met the same issue on all platform(MacOS, CentOS, Debian), the DNS like:
And I got error:
|
The way reqwest does DNS, as mentioned above, it simply to use the method from libstd. Any issues there would be problems with your libc You can try enabling the I don't think there's anything reqwest can do otherwise, so I'm going to close this. |
I have already tried enabling the Trust-DNS feature, but the problem still exists on three platforms. Currently, I have rewritten my code using Golang to solve the problem. |
I solved this by caching the dns lookups in the client with use std::net::ToSocketAddrs;
let sock_addrs = format!("{host}:443").to_socket_addrs()?.collect::<Vec<_>>();
let client = reqwest::Client::builder()
.resolve_to_addrs(host, &sock_addrs)
.build()?) |
I'm getting this error :
Error: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("www.google.com")), port: None, path: "/", query: None, fragment: None }, source: hyper::Error(Connect, ConnectError("dns error", Custom { kind: Other, error: "failed to lookup address information: nodename nor servname provided, or not known" })) }
when I run this code:
Note that it works for other sites, namely reddit.com, however it also fails on rust-lang.org, twitter.com among others. It's seemingly a bit random which sites it will work on. ATM I'm assuming this is something to do with my setup, running MacOS 10.14.6, but I am unsure.
I've also tried it using reqwest in blocking mode and the same issues persist with an identical error.
The text was updated successfully, but these errors were encountered: