summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-02-07 16:15:46 +0100
committerKarolin Seeger <kseeger@samba.org>2019-03-05 07:39:27 +0000
commit0f1525d430ec4975952520b00cbd4c5e49f9b097 (patch)
tree3286c810dd04541802901f7e05e138d8efc21cda
parente2b7d3ff62745c1205a36b296e9371636950cc85 (diff)
downloadsamba-0f1525d430ec4975952520b00cbd4c5e49f9b097.tar.gz
messages_dgm: Properly handle receiver re-initialization
This only properly covers the small-message nonblocking case. Covering the large-message and the blocking case is a much larger effort assuming we want to re-send the failed message if parts of the message has gone through properly. Don't do that for now. This was found by sanba_dnsupdate constantly recreating its irpc handle to winbindd in the RODC case. The messaging_dgm code cached connected datagram sockets based on the destination pid for 1 second. Which means the IRPC responses from winbindd are never delivered to samba_dnsupdate, which will then hit a timeout. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13786 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from commit 2543bba0364d8054e9ad316f5611621841bc061d)
-rw-r--r--selftest/knownfail.d/local-messaging1
-rw-r--r--source3/lib/messages_dgm.c16
2 files changed, 16 insertions, 1 deletions
diff --git a/selftest/knownfail.d/local-messaging b/selftest/knownfail.d/local-messaging
deleted file mode 100644
index 46cf30c7316..00000000000
--- a/selftest/knownfail.d/local-messaging
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smbtorture_s3.LOCAL-MESSAGING-READ3
diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index 91b9d65b7a4..2fd63008b69 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -1415,6 +1415,7 @@ int messaging_dgm_send(pid_t pid,
struct messaging_dgm_context *ctx = global_dgm_context;
struct messaging_dgm_out *out;
int ret;
+ unsigned retries = 0;
if (ctx == NULL) {
return ENOTCONN;
@@ -1422,6 +1423,7 @@ int messaging_dgm_send(pid_t pid,
messaging_dgm_validate(ctx);
+again:
ret = messaging_dgm_out_get(ctx, pid, &out);
if (ret != 0) {
return ret;
@@ -1431,6 +1433,20 @@ int messaging_dgm_send(pid_t pid,
ret = messaging_dgm_out_send_fragmented(ctx->ev, out, iov, iovlen,
fds, num_fds);
+ if (ret == ECONNREFUSED) {
+ /*
+ * We cache outgoing sockets. If the receiver has
+ * closed and re-opened the socket since our last
+ * message, we get connection refused. Retry.
+ */
+
+ TALLOC_FREE(out);
+
+ if (retries < 5) {
+ retries += 1;
+ goto again;
+ }
+ }
return ret;
}