summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-11-07 15:26:01 +0100
committerAmitay Isaacs <amitay@samba.org>2019-11-14 02:20:46 +0000
commita6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f (patch)
tree7a7df4d492e4e6d1371632e28d679e5ced64dc9b
parent231397f45ee7a328ea41214b1367632298339e44 (diff)
downloadsamba-a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f.tar.gz
ctdb-tcp: Close inflight connecting TCP sockets after fork
Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets while sitting in the async connect() syscall are not freed via ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure. Free this structure as well. If an outgoing TCP socket leaks into a long-running child process (possibly the recovery daemon), this connection will never be closed as seen by the destination node. Because with recent changes incoming connections will not be accepted as long as any incoming connection is alive, with that socket leak into the recovery daemon we will never again be able to successfully connect to the node that is affected by this leak. Further attempts to connect will be discarded by the destination as long as the recovery daemon keeps this socket alive. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 RN: Avoid communication breakdown on node reconnect Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r--ctdb/tcp/tcp_init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index 3be16bd7d5e..0eb9799ac4a 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -137,8 +137,14 @@ static void ctdb_tcp_shutdown(struct ctdb_context *ctdb)
{
struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
struct ctdb_tcp);
+ uint32_t i;
+
talloc_free(ctcp);
ctdb->private_data = NULL;
+
+ for (i=0; i<ctdb->num_nodes; i++) {
+ TALLOC_FREE(ctdb->nodes[i]->private_data);
+ }
}
/*