Commit ad3751b5 authored by Volker Lendecke's avatar Volker Lendecke Committed by Karolin Seeger

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=13786Signed-off-by: default avatarVolker Lendecke <vl@samba.org>
Reviewed-by: default avatarStefan Metzmacher <metze@samba.org>
Reviewed-by: default avatarAndrew Bartlett <abartlet@samba.org>
(cherry picked from commit 2543bba0)
parent 9dd1b416
^samba3.smbtorture_s3.LOCAL-MESSAGING-READ3
......@@ -1421,6 +1421,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;
......@@ -1428,6 +1429,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;
......@@ -1437,6 +1439,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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment