Skip to content

Commit 8622fc7

Browse files
committed
Merge pull request #1673 from rabbitmq/lrb-add-channel_max-detail
Add detail for channel_max 0 value (cherry picked from commit c7dea58)
1 parent cd0e2b2 commit 8622fc7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/rabbit_reader.erl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ log_connection_exception(Severity, Name, {connection_closed_abruptly, _}) ->
429429
log_connection_exception_with_severity(Severity,
430430
"closing AMQP connection ~p (~s):~nclient unexpectedly closed TCP connection~n",
431431
[self(), Name]);
432+
%% failed connection.tune negotiations
433+
log_connection_exception(Severity, Name, {handshake_error, tuning, _Channel,
434+
{exit, #amqp_error{explanation = Explanation},
435+
_Method, _Stacktrace}}) ->
436+
log_connection_exception_with_severity(Severity,
437+
"closing AMQP connection ~p (~s):~nfailed to negotiate connection parameters: ~s~n",
438+
[self(), Name, Explanation]);
432439
%% old exception structure
433440
log_connection_exception(Severity, Name, connection_closed_abruptly) ->
434441
log_connection_exception_with_severity(Severity,
@@ -445,7 +452,7 @@ log_connection_exception_with_severity(Severity, Fmt, Args) ->
445452
debug -> rabbit_log_connection:debug(Fmt, Args);
446453
info -> rabbit_log_connection:info(Fmt, Args);
447454
warning -> rabbit_log_connection:warning(Fmt, Args);
448-
error -> rabbit_log_connection:warning(Fmt, Args)
455+
error -> rabbit_log_connection:error(Fmt, Args)
449456
end.
450457

451458
run({M, F, A}) ->
@@ -1297,9 +1304,10 @@ fail_negotiation(Field, MinOrMax, ServerValue, ClientValue) ->
12971304
min -> {lower, minimum};
12981305
max -> {higher, maximum}
12991306
end,
1307+
ClientValueDetail = get_client_value_detail(Field, ClientValue),
13001308
rabbit_misc:protocol_error(
1301-
not_allowed, "negotiated ~w = ~w is ~w than the ~w allowed value (~w)",
1302-
[Field, ClientValue, S1, S2, ServerValue], 'connection.tune').
1309+
not_allowed, "negotiated ~w = ~w~s is ~w than the ~w allowed value (~w)",
1310+
[Field, ClientValue, ClientValueDetail, S1, S2, ServerValue], 'connection.tune').
13031311

13041312
get_env(Key) ->
13051313
{ok, Value} = application:get_env(rabbit, Key),
@@ -1721,3 +1729,9 @@ dynamic_connection_name(Default) ->
17211729
handle_uncontrolled_channel_close(ChPid) ->
17221730
rabbit_core_metrics:channel_closed(ChPid),
17231731
rabbit_event:notify(channel_closed, [{pid, ChPid}]).
1732+
1733+
-spec get_client_value_detail(atom(), integer()) -> string().
1734+
get_client_value_detail(channel_max, 0) ->
1735+
" (no limit)";
1736+
get_client_value_detail(_Field, _ClientValue) ->
1737+
"".

0 commit comments

Comments
 (0)