summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_channel.erl8
-rw-r--r--src/rabbit_reader.erl34
2 files changed, 26 insertions, 16 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 8955c406ac..0c012898f3 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -446,11 +446,11 @@ handle_exception(Reason, State = #ch{protocol = Protocol,
{_Result, State1} = notify_queues(State),
case rabbit_binary_generator:map_exception(Channel, Reason, Protocol) of
{Channel, CloseMethod} ->
- rabbit_log:error("Channel error on connection ~s (vhost '~s',"
- " user '~s', pid: ~p), channel ~p:~n~p~n",
- [ConnName, binary_to_list(VHost),
+ rabbit_log:error("Channel error on connection ~p (~s, vhost: '~s',"
+ " user: '~s'), channel ~p:~n~p~n",
+ [ConnPid, ConnName, binary_to_list(VHost),
binary_to_list(User#user.username),
- ConnPid, Channel, Reason]),
+ Channel, Reason]),
ok = rabbit_writer:send_command(WriterPid, CloseMethod),
{noreply, State1};
{0, _} ->
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index be554c6464..0261a036d1 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -189,10 +189,10 @@ server_capabilities(_) ->
log(Level, Fmt, Args) -> rabbit_log:log(connection, Level, Fmt, Args).
socket_error(Reason) when is_atom(Reason) ->
- log(error, "error on AMQP connection ~p: ~s~n",
+ log(error, "Error on AMQP connection ~p: ~s~n",
[self(), rabbit_misc:format_inet_error(Reason)]);
socket_error(Reason) ->
- log(error, "error on AMQP connection ~p:~n~p~n", [self(), Reason]).
+ log(error, "Error on AMQP connection ~p:~n~p~n", [self(), Reason]).
inet_op(F) -> rabbit_misc:throw_on_error(inet_error, F).
@@ -548,7 +548,12 @@ wait_for_channel_termination(0, TimerRef, State) ->
end;
_ -> State
end;
-wait_for_channel_termination(N, TimerRef, State) ->
+wait_for_channel_termination(N, TimerRef,
+ State = #v1{connection_state = CS,
+ connection = #connection{
+ name = ConnName,
+ user = User,
+ vhost = VHost}}) ->
receive
{'DOWN', _MRef, process, ChPid, Reason} ->
{Channel, State1} = channel_cleanup(ChPid, State),
@@ -558,9 +563,13 @@ wait_for_channel_termination(N, TimerRef, State) ->
{_, controlled} -> wait_for_channel_termination(
N-1, TimerRef, State1);
{_, uncontrolled} -> log(error,
- "AMQP connection ~p, channel ~p - "
+ "Error on AMQP connection ~p (~s, vhost: '~s',"
+ " user: '~s', state: ~p), channel ~p:"
"error while terminating:~n~p~n",
- [self(), Channel, Reason]),
+ [self(), ConnName,
+ binary_to_list(VHost),
+ binary_to_list(User#user.username),
+ CS, Channel, Reason]),
wait_for_channel_termination(
N-1, TimerRef, State1)
end;
@@ -582,16 +591,17 @@ termination_kind(normal) -> controlled;
termination_kind(_) -> uncontrolled.
log_hard_error(State = #v1{connection_state = CS,
- connection = #connection{name = ConnName,
- user = User,
- vhost = VHost}},
+ connection = #connection{
+ name = ConnName,
+ user = User,
+ vhost = VHost}},
Channel, Reason) ->
log(error,
- "Connection error on connection ~s (state: ~p, vhost: '~s',"
- " user: '~s', pid: ~p), channel ~p:~n~p~n",
- [ConnName, CS,
+ "Error on AMQP connection ~p (~s, vhost: '~s',"
+ " user: '~s', state: ~p), channel ~p:~n~p~n",
+ [self(), ConnName,
binary_to_list(VHost), binary_to_list(User#user.username),
- self(), Channel, Reason]).
+ CS, Channel, Reason]).
handle_exception(State = #v1{connection_state = closed}, Channel, Reason) ->
log_hard_error(State, Channel, Reason),