diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-09-03 18:34:49 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-09-03 18:34:49 +0100 |
commit | 05a8e69c70a290a3b27c48abac1f4c069ad5a92e (patch) | |
tree | b6b76da510eead07d212cb3ae4cd5bc83f0ae83f | |
parent | fef645432aa37b98ab39d9c4203a067f86ca0932 (diff) | |
download | rabbitmq-server-bug25120.tar.gz |
explainbug25120
-rw-r--r-- | src/rabbit_net.erl | 11 | ||||
-rw-r--r-- | src/rabbit_reader.erl | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl index eacff141..038154c3 100644 --- a/src/rabbit_net.erl +++ b/src/rabbit_net.erl @@ -154,9 +154,14 @@ fast_close(Sock) when ?IS_SSL(Sock) -> %% We cannot simply port_close the underlying tcp socket since the %% TLS protocol is quite insistent that a proper closing handshake %% should take place (see RFC 5245 s7.2.1). So we call ssl:close - %% instead, but that can block for a very long time if the socket - %% is in a funny state. Since there is no timeout variant of - %% ssl:close, we construct our own. + %% instead, but that can block for a very long time, e.g. when + %% there is lots of pending output and there is tcp backpressure, + %% or the ssl_connection process has entered the the + %% workaround_transport_delivery_problems function during + %% termination, which, inexplicably, does a gen_tcp:recv(Socket, + %% 0), which may never return if the client doesn't send a FIN or + %% that gets swallowed by the network. Since there is no timeout + %% variant of ssl:close, we construct our own. {Pid, MRef} = spawn_monitor(fun () -> ssl:close(Sock#ssl_socket.ssl) end), erlang:send_after(?SSL_CLOSE_TIMEOUT, self(), {Pid, ssl_close_timeout}), receive diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 4bcb347d..aef48b20 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -184,6 +184,7 @@ socket_op(Sock, Fun) -> {ok, Res} -> Res; {error, Reason} -> log(error, "error on AMQP connection ~p: ~p~n", [self(), Reason]), + %% NB: this is tcp socket, even in case of ssl rabbit_net:fast_close(Sock), exit(normal) end. |