[PATCH] python indent bugfix in dns_hub.py

Tim Beale timbeale at catalyst.net.nz
Tue Jan 22 21:11:32 UTC 2019


Hi Isaac,

I think what you're seeing is the same essential problem (slowness
responding to the DNS query), it's just manifesting in a different way.
In your case it looks like it's taking longer than 5 seconds, so the
s.recv() times out. In my case, it's taking less than 5 seconds, so the
s.recv() is OK, but the sock.sendto() fails (because the client has
given up).

E.g. if I put a sleep() in dns_process_send() on the DNS server, if I
make the sleep greater than 5 secs then I see your problem. Less than 5
secs, I see the sock.sendto() problem.

You're correct that changing DNS_REQUEST_TIMEOUT won't help your case.
The dns_hub.py code is just using a plain socket, so it's not actually
using this timeout value at all.

You could try increasing the timeout dns_hub,py uses (e.g. attached).
Hopefully this will change the error you're seeing to the sock.sendto()
problem instead. If that's the case, then we'll either need to increase
the resolv.conf timeout for autobuild, or try Metze's wait_for_start() idea.

Cheers,
Tim

On 22/01/19 8:54 PM, Isaac Boukris wrote:
> Hi,
>
> On Tue, Jan 22, 2019 at 8:22 AM Jeremy Allison via samba-technical
> <samba-technical at lists.samba.org> wrote:
>> On Mon, Jan 21, 2019 at 09:57:27PM -0800, Jeremy Allison via samba-technical wrote:
>>> On Mon, Jan 21, 2019 at 09:18:02PM -0800, Jeremy Allison via samba-technical wrote:
>>>> On Mon, Jan 21, 2019 at 09:05:46PM -0800, Jeremy Allison via samba-technical wrote:
>>>>>> I'm guessing this could either be happening because the DC's DNS server
>>>>>> process is slow to process the query (because the DC only just started
>>>>>> up), or the CI machine is just heavily loaded and so it takes a while to
>>>>>> proxy the DNS query/response back and forth between the DC and client.
>>>>> Great work Tim ! Could we fix this by adding
>>>>> retries to finddcs_cldap() ?
>>>> Is this the call to finddcs_cldap() called from
>>>> the python glue in:
>>>>
>>>> source4/libnet/py_net.c
>>>>
>>>> ? If so, adding 3x retries there would be fairly
>>>> simple.
>>>>
>>>> Just wanted to thank you for the debugging work
>>>> here ! I tried but just couldn't reproduce this,
>>>> and thinking of adding a 2 second sleep in
>>>> dns_transaction_udp() to reproduce a slow server
>>>> was a great insight (obvious in hindsight, but
>>>> all the great insights usually are. i.e. I hate
>>>> myself for being too dumb to spot this :-). !
>>> One last quick thought before I call it quits for
>>> the night :-).
>> OK, can't quite call it quits - couldn't sleep
>> whist this was bugging me :-).
>>
>> The 2 second thing was nagging at me. Checking
>> libcli/dns/dns.c we have:
>>
>> #define DNS_REQUEST_TIMEOUT 2
> FYI, changing DNS_REQUEST_TIMEOUT to 10 or to 30 does not help in my
> local reproduction.
>
> I think timeouts might sometimes be ignored when receiving a network
> error such as port unreachable an so.
-------------- next part --------------
diff --git a/python/samba/tests/dns_forwarder_helpers/dns_hub.py b/python/samba/tests/dns_forwarder_helpers/dns_hub.py
index 2ac6753..908221c 100755
--- a/python/samba/tests/dns_forwarder_helpers/dns_hub.py
+++ b/python/samba/tests/dns_forwarder_helpers/dns_hub.py
@@ -41,7 +41,7 @@ class DnsHandler(sserver.BaseRequestHandler):
         try:
             send_packet = ndr.ndr_pack(packet)
             s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
-            s.settimeout(5)
+            s.settimeout(10)
             s.connect((host, 53))
             s.sendall(send_packet, 0)
             recv_packet = s.recv(2048, 0)


More information about the samba-technical mailing list