ctdb-tcp: Close inflight connecting TCP sockets after fork
commit70c829304e0d24c228bde79a6dd6597e7e2e185a
authorVolker Lendecke <vl@samba.org>
Thu, 7 Nov 2019 14:26:01 +0000 (7 15:26 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 19 Nov 2019 13:21:18 +0000 (19 13:21 +0000)
treed3d244ed8893b357edb999560107da100fc91522
parent0b78c29a0fa091d54871cac084e9673605ae6a4e
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>
(cherry picked from commit a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f)

Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-11-test): Tue Nov 19 13:21:18 UTC 2019 on sn-devel-184
ctdb/tcp/tcp_init.c