Skip to content
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

DNS timeout passing empty string causing error #2143

Open
julesfarrow opened this issue Jul 27, 2022 · 1 comment
Open

DNS timeout passing empty string causing error #2143

julesfarrow opened this issue Jul 27, 2022 · 1 comment

Comments

@julesfarrow
Copy link

Receiving the following error via email once every few days since updating to v57

multiprocessing.pool.RemoteTraceback:

"""
Traceback (most recent call last):
File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/dns/resolver.py", line 982, in nameservers
raise NotImplementedError
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "management/status_checks.py", line 380, in run_domain_checks_on_domain
check_dns_zone(domain, env, output, dns_zonefiles)
File "management/status_checks.py", line 551, in check_dns_zone
ip = query_dns(domain, "A", at=ns_ip, nxdomain=None)
File "management/status_checks.py", line 793, in query_dns
resolver.nameservers = [at]
File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/dns/resolver.py", line 984, in nameservers
raise ValueError(f'nameserver {nameserver} is not an '
ValueError: nameserver [timeout] is not an IP address or valid https URL
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "management/status_checks.py", line 1100, in
run_and_output_changes(env, pool)
File "management/status_checks.py", line 945, in run_and_output_changes
run_checks(True, env, cur, pool)
File "management/status_checks.py", line 67, in run_checks
run_domain_checks(rounded_values, env, output, pool, domains_to_check=domains_to_check)
File "management/status_checks.py", line 351, in run_domain_checks
ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
File "/usr/lib/python3.6/multiprocessing/pool.py", line 274, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
ValueError: nameserver [timeout] is not an IP address or valid https URL

@kiekerjan
Copy link
Contributor

kiekerjan commented Aug 26, 2022

Looks like the code does not check if the value returned from query_dns is valid. Maybe something like this would solve it? See the changed if statement.

                      ns_ips = query_dns(ns, "A")  
                      if not ns_ips or ns_ips in {'[Not Set]', '[timeout]'}:  
                              output.print_error("Secondary nameserver %s is not valid (it doesn't resolve to an IP address)." % ns)    
                              continue  
                      # Choose the first IP if nameserver returns multiple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants