[PATCH] python indent bugfix in dns_hub.py
Jeremy Allison
jra at samba.org
Tue Jan 22 05:57:27 UTC 2019
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 :-).
It's the calls to ctx.net.finddc() in the code below
from python/samba/join.py that are erroring out:
def find_dc(ctx, domain):
"""find a writeable DC for the given domain"""
try:
ctx.cldap_ret = ctx.net.finddc(domain=domain, flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS |
except NTSTATUSError as error:
raise Exception("Failed to find a writeable DC for domain '%s': %s" %
(domain, error[1]))
except Exception:
raise Exception("Failed to find a writeable DC for domain '%s'" % domain)
if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site != "":
ctx.site = ctx.cldap_ret.client_site
return ctx.cldap_ret.pdc_dns_name
def find_dc_site(ctx, server):
site = None
cldap_ret = ctx.net.finddc(address=server,
flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS)
if cldap_ret.client_site is not None and cldap_ret.client_site != "":
site = cldap_ret.client_site
return site
A quick fix might be to try the ctx.net.finddc() calls in
a loop (try 3 times or so) as this code needs to be made
more robust against flakey DNS / cldap servers anyway.
Does that sound like a plan ? I can try and code up a
patch for that and test on gitlab-CI tomorrow when I'm
back in at work.
Jeremy.
More information about the samba-technical
mailing list