From: Diego Fronza Date: Tue, 20 Apr 2021 15:59:46 +0000 (-0300) Subject: Handling NoNameservers exception X-Git-Tag: v9.17.14~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b19cd2d83bb28fb11e6f56422cc71d0bd80d8d7c;p=thirdparty%2Fbind9.git Handling NoNameservers exception In the shutdown system test multiple queries are sent to a resolver instance, in the meantime we terminate the same resolver process for which the queries were sent to, either via rndc stop or a SIGTERM signal, that means the resolver may not be able to answer all those queries, since it has initiated the shutdown process. The dnspython library raises a dns.resolver.NoNameservers exception when a resolver object fails to receive an answer from the specified list of nameservers (resolver.nameservers list), we need to handle this exception as this is something that may happen since we asked the resolver to terminate, as a result it may not answer clients even if an answer is available, as the operation will be canceled. --- diff --git a/bin/tests/system/shutdown/tests-shutdown.py b/bin/tests/system/shutdown/tests-shutdown.py index 1556f9f5fbd..458a777b106 100755 --- a/bin/tests/system/shutdown/tests-shutdown.py +++ b/bin/tests/system/shutdown/tests-shutdown.py @@ -98,7 +98,6 @@ def do_work(named_proc, resolver, rndc_cmd, kill_method, n_workers, n_queries): futures[executor.submit(launch_rndc, ['stop'])] = 'stop' else: futures[executor.submit(named_proc.terminate)] = 'kill' - else: # We attempt to send couple rndc commands while named is # being shutdown @@ -117,7 +116,9 @@ def do_work(named_proc, resolver, rndc_cmd, kill_method, n_workers, n_queries): if futures[future] == "stop": ret_code = result - except (dns.resolver.NXDOMAIN, dns.exception.Timeout): + except (dns.resolver.NXDOMAIN, + dns.resolver.NoNameservers, + dns.exception.Timeout): pass if kill_method == "rndc":