-
Notifications
You must be signed in to change notification settings - Fork 4k
Log TCP acceptor (Ranch) timeout and TLS [handshake-related] errors #13979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log TCP acceptor (Ranch) timeout and TLS [handshake-related] errors #13979
Conversation
Protocol = ranch_ref_to_protocol(Ref), | ||
rabbit_log:error("~p error during handshake for protocol ~p and peer ~ts", | ||
[Reason, Protocol, PeerAddress]), | ||
exit({shutdown, {Reason, PeerInfo}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better in both catch cases to call erlang:raise/3
so that we don't lose the stacktrace which may be propagated to other processes.
@@ -547,7 +562,7 @@ failed_to_recv_proxy_header(Ref, Error) -> | |||
end, | |||
rabbit_log:debug(Msg, [Error]), | |||
% The following call will clean up resources then exit | |||
_ = ranch:handshake(Ref), | |||
_ = catch ranch:handshake(Ref), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way of doing catch is being deprecated by Erlang/OTP team so it would be better as a try catch.
try_ranch_handshake(Ref) -> | ||
try ranch:handshake(Ref) of | ||
{ok, Sock} -> | ||
Sock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no reason no to return {ok, Sock}
. You could also use the name ranch_handshake
as the "try" doesn't tell us much.
bc8023b
to
223ef6d
Compare
223ef6d
to
3a5dc94
Compare
The failures are not specific to this PR. |
Log TCP acceptor (Ranch) timeout and TLS [handshake-related] errors (backport #13979)
Proposed Changes
This PR addresses #11171
The proposed changes catch the exit signal emitted by
ranch:handshake
inrabbit_networking:handshake
and log an error message in case the reason for shutting down the connection is other thanclosed
.The reason for not logging
closed
shutdown exit exceptions has been added as a context comment in the source.Types of Changes
Checklist
Put an
x
in the boxes that apply.You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.md
documentFurther Comments