diff options
author | Ayanda-D <ayanda.dube@erlang-solutions.com> | 2020-10-20 08:27:15 +0100 |
---|---|---|
committer | Ayanda-D <ayanda.dube@erlang-solutions.com> | 2020-10-20 08:27:15 +0100 |
commit | be713c4a7a71d8518e351c5d20b7c1e1c6f6a7b7 (patch) | |
tree | 08f2d8f817d68f5f0bbb59b21f2f5a98425027a4 /deps/rabbitmq_federation/src | |
parent | 986f5830e484dd79748041ece19c60d515279e41 (diff) | |
download | rabbitmq-server-git-be713c4a7a71d8518e351c5d20b7c1e1c6f6a7b7.tar.gz |
If amqp_connection:start/2 succeeds, it would be
very rare for amqp_connection:open_channel/2 to
timeout and result in the same fate of direct
connection and channel leaks. However, it can't
be ruled out in an unstable TCP network. This
commit prevents possibility of process leaks
on such failed channel establishment cases.
Diffstat (limited to 'deps/rabbitmq_federation/src')
-rw-r--r-- | deps/rabbitmq_federation/src/rabbit_federation_link_util.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/deps/rabbitmq_federation/src/rabbit_federation_link_util.erl b/deps/rabbitmq_federation/src/rabbit_federation_link_util.erl index afb46c4815..a5fd560f0b 100644 --- a/deps/rabbitmq_federation/src/rabbit_federation_link_util.erl +++ b/deps/rabbitmq_federation/src/rabbit_federation_link_util.erl @@ -112,11 +112,18 @@ open(Params, Name) -> try amqp_connection:start(Params, Name) of - {ok, Conn} -> case amqp_connection:open_channel(Conn) of - {ok, Ch} -> {ok, Conn, Ch}; - E -> ensure_connection_closed(Conn), - E - end; + {ok, Conn} -> + try + amqp_connection:open_channel(Conn) + of + {ok, Ch} -> {ok, Conn, Ch}; + E -> ensure_connection_closed(Conn), + E + catch + _:E -> + ensure_connection_closed(Conn), + E + end; E -> E catch _:E -> E |