If the list of hosts you're resolving contains duplicate entries, the resolve() function hangs/freezes causing the ADNS script itself to hang.
Steps to Reproduce:
- duplicate_host_list = ["google.com","oracle.com","google.com"]
- ar = AsyncResolver(duplicate_host_list)
- resolved_hosts = ar.resolve()
The script always hangs at step 3. If you get rid of the duplicate domain (i.e. google.com) and retry this, everything works perfectly.
I modified main() in asnc_dns.py slightly to test this. This is what it looks like,
if __name__ == "__main__":
hosts = ["google.com","oracle.com","google.com"]
ar = AsyncResolver(hosts, intensity=500)
start = time()
resolved_hosts = ar.resolve()
end = time()
print "It took %.2f seconds to resolve %d hosts." % (end-start, len(hosts))