-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno 2.1.5 regressions with DNS regarding axios (due to node compat change) #27670
Comments
Do you see these error messages with exactly the above example, or do you modify the URL part? If I ran the first example, I saw the errors like:
which is the same as what Node.js shows.
This case seems a regression in 2.1.5. I'll work on it. Note: We changed the internal implementation of Node compat I guess probably our dns resolver (It internally uses Deno.resolveDns which internally uses hickory-dns) is now too strict about handling dns data. The error message is likely from here https://github.com/hickory-dns/hickory-dns/blob/b942d68020ee6f88bbd459812c5fab22b748413c/crates/proto/src/udp/udp_client_stream.rs#L318 |
@kt3k for the first case - yeah, I see errors in the console with that exact code. It takes some time to get them though, a few seconds perhaps. This is what
|
Do you see the same error ( console.log(await Deno.resolveDns("test.openai.azure.com.", "A")); |
Hmm, no, if I do this (even in a loop or multiple concurrent ones), it's all fine. Is there a way I can understand why I'm getting all those console errors? I could build Deno if needed |
Sounds very strange situation to me..
import dns from "node:dns"
dns.lookup("test.openai.azure.com", console.log); import https from "node:https"
https.request("https://test.openai.azure.com", console.log).end() |
Yeah, I get the error with the first snippet, but it's inconsistent. Sometimes it just gives the IP straight away, sometimes it does this:
|
Thanks for the replies! This issue might be related to hickory-dns/hickory-dns#2140 Do you know if the size of the response from the name server in your environment exceeds 512 bytes? Can you share the full result of I'll try to reproduce the issue by simulating the name server with large response |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Yep, nevermind, @kt3k you don't need to care about the first part - apparently for some really weird reason my router defaulted to 4096 max udp packet size for DNS, and it worked so far for years in every software on every OS, but I guess that Rust crate is really strict to the spec :) I set it to 500 and it works fine now. |
Thanks for the further inputs! It's interesting to see that changing the router settings fixes the issue.
I'm not completely sure if we should ignore larger DNS packet sizes when they work on most OSes and software.. |
I was able to reproduce the issue (of hickory-dns) by the below script: import dns2 from "npm:dns2";
const { Packet } = dns2;
const server = dns2.createServer({
udp: true,
handle(request, send) {
const response = Packet.createResponseFromRequest(request);
const { name } = request.questions[0];
for (const i of [...Array(256).keys()]) {
response.answers.push({
name,
type: Packet.TYPE.A,
class: Packet.CLASS.IN,
ttl: 300,
address: "1.2.3." + i,
});
}
send(response);
},
});
server.listen({ udp: { port: 5333, address: "127.0.0.1", type: "udp4" } });
setTimeout(() => {
Deno.resolveDns("example.com", "A", {
nameServer: { ipAddr: "127.0.0.1", port: 5333 },
});
}); The DNS server returns large result of 6941 bytes. |
Noticed that some of my scripts started failing after I upgraded to 2.1.5.
Outdated, my Mikrotik router had max DNS packet size set to 4096, while the spec apparently only allows up to 512.
This replicates part of the issue:With this script I'm getting random logs like:
In my real script (sadly I cannot publish that code) I also get those random errors. In short, the real code does lots of requests each second to different domains some of which don't exist anymore, but most do:
Second case (I discovered this by accident):
With Deno 2.1.4 and below this runs properly and outputs "caught it" (since it catches the error), with 2.1.5 I get a hard crash (that does not get caught by the
catch
):With native
fetch
everything works fine.#27642 might have the same root cause
The text was updated successfully, but these errors were encountered: