samba_dnsupdate: make rodc_dns_update() more robust against timing problems
authorStefan Metzmacher <metze@samba.org>
Thu, 7 Feb 2019 08:42:36 +0000 (09:42 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Feb 2019 01:18:29 +0000 (02:18 +0100)
commit19f34b2161dee26ebaee2774b4bee0dc3ce9e340
tree98ac8f89ece0274d31388b9ed9b9a7793020c1cb
parent767e60d97390f90e1b0579d4108ede51a9116952
samba_dnsupdate: make rodc_dns_update() more robust against timing problems

Without this we had an interesting race!

The messaging_dgm code caches connected datagram sockets based on the
destination pid for 1 second.

The fact that samba_dnsupdate constantly recreates its messaging
context (and the underlying datagram socket) means that we the winbindd
messaging context may get a stale connection. As a result sending any
message from winbindd back to samba_dnsupdate will result in
ECONNREFUSED.

That means the IRPC response from winbindd never reaches
samba_dnsupdate, which will then hit a timeout.

In turn samba_dnsupdate on the RODC times out.

This was a workaround for the problem, by having just one global
IRPC handle and thus just one messaging_dgm context.
The actual problem is solved a few commits before
("messages_dgm: Properly handle receiver re-initialization").
But we keep this as an performance optimization, which hopefully
means that the overall samba_dnsupdate is less likely to
timeout after the hardcoded 20 seconds.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/scripting/bin/samba_dnsupdate