tungd / elixir-dns

DNS library for Elixir
BSD 3-Clause "New" or "Revised" License
114 stars 37 forks source link

Providing a bad DNS server results in hanging indefinitely #31

Closed jdppettit closed 3 years ago

jdppettit commented 4 years ago

Using resolve/3 like so:

DNS.resolve("google.com", :a, {"not.a.dns.server.com", 53})

Results in the call hanging indefinitely (or at least appears to hang indefinitely). This can be corrected by using recv!/2 rather than recv!/1 with a timeout option here:

https://github.com/tungd/elixir-dns/blob/master/lib/dns.ex#L48

I forked and made this change for my own purposes for now (https://github.com/silverp1/elixir-dns/commit/08c535afe84afc725edd9b0b99bdfaa6f41ee917) but figured I'd raise the issue to see what folks think about doing something like this in master.

My use case here is a monitoring application where users supply the record to check as well as the DNS server to query.

tungd commented 4 years ago

I'll fix this in the next release. Thank you very much 👍