Skip to content

Commit 1f01500

Browse files
ansdmergify[bot]
authored andcommitted
Print more logs when stream connection fails to open
This commit will print ``` [debug] <0.725.0> Transitioned from tcp_connected to peer_properties_exchanged [debug] <0.725.0> Transitioned from peer_properties_exchanged to authenticating [debug] <0.725.0> User 'guest' authenticated successfully by backend rabbit_auth_backend_internal [debug] <0.725.0> Transitioned from authenticating to authenticated [debug] <0.725.0> Tuning response 1048576 0 [debug] <0.725.0> Open frame received for fakevhost [warning] <0.725.0> Opening connection failed: access to vhost 'fakevhost' refused for user 'guest' [debug] <0.725.0> Transitioned from tuning to failure [warning] <0.725.0> Closing socket #Port<0.48>. Invalid transition from tuning to failure. [debug] <0.725.0> rabbit_stream_reader terminating in state 'tuning' with reason 'normal' ``` when the user doesn't have access to the vhost. (cherry picked from commit f6d4fc2)
1 parent 597858b commit 1f01500

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

deps/rabbitmq_stream/src/rabbit_stream_reader.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,14 +1502,14 @@ handle_frame_pre_auth(Transport,
15021502
Connection#stream_connection{connection_step = opened,
15031503
virtual_host = VirtualHost}),
15041504
Conn
1505-
catch
1506-
exit:_ ->
1507-
F = rabbit_stream_core:frame({response, CorrelationId,
1508-
{open,
1509-
?RESPONSE_VHOST_ACCESS_FAILURE,
1510-
#{}}}),
1511-
send(Transport, S, F),
1512-
Connection#stream_connection{connection_step = failure}
1505+
catch exit:#amqp_error{explanation = Explanation} ->
1506+
rabbit_log:warning("Opening connection failed: ~ts", [Explanation]),
1507+
F = rabbit_stream_core:frame({response, CorrelationId,
1508+
{open,
1509+
?RESPONSE_VHOST_ACCESS_FAILURE,
1510+
#{}}}),
1511+
send(Transport, S, F),
1512+
Connection#stream_connection{connection_step = failure}
15131513
end,
15141514

15151515
{Connection1, State};

0 commit comments

Comments
 (0)