-
Notifications
You must be signed in to change notification settings - Fork 935
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
Add remote address information in SessionProtocolNegotiationException #6113
Add remote address information in SessionProtocolNegotiationException #6113
Conversation
public SessionProtocolNegotiationException(SessionProtocol expected, @Nullable String reason) { | ||
super(appendReason("expected: " + requireNonNull(expected, "expected"), reason)); | ||
public SessionProtocolNegotiationException(SessionProtocol expected, | ||
@Nullable SocketAddress remoteAddress, |
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.
These are breaking changes. What do you think of adding the remote address to the reason?
If Channel
is available when raising SessionProtocolNegotiationException
, should we set it as a hint instead? This provides users with more troubleshooting information via Channel.toString()
.
"...some reason (remoteAddress: ...)"
or
"...some reason (channel: ...)"
@ikhoon The test modified along with this pull request is failing only on the Windows platform. I don’t have access to a Windows machine, so it’s difficult for me to debug the issue. How would you suggest I approach resolving this? |
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.
Thanks! 🙏🙇♂️
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.
Thanks!
desiredProtocol, "previously failed negotiation")), | ||
desiredProtocol, | ||
"previously failed negotiation (remoteAddress: " + | ||
remoteAddress + ")")), |
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.
remoteAddress + ")")), | |
remoteAddress + ')')), |
@@ -461,7 +461,8 @@ void finishWithNegotiationFailure( | |||
final ChannelPipeline pipeline = ctx.pipeline(); | |||
pipeline.channel().eventLoop().execute( | |||
() -> pipeline.fireUserEventTriggered( | |||
new SessionProtocolNegotiationException(expected, actual, reason))); | |||
new SessionProtocolNegotiationException( | |||
expected, actual, reason + " (channel: " + pipeline.channel() + ")"))); |
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.
expected, actual, reason + " (channel: " + pipeline.channel() + ")"))); | |
expected, actual, reason + " (channel: " + pipeline.channel() + ')'))); |
@@ -174,7 +174,7 @@ private void scheduleSessionTimeout(Channel channel, Promise<Channel> sessionPro | |||
sessionTimeoutFuture = channel.eventLoop().schedule(() -> { | |||
if (sessionPromise.tryFailure(new SessionProtocolNegotiationException( | |||
desiredProtocol, | |||
"connection established, but session creation timed out: " + channel))) { | |||
"connection established, but session creation timed out. (channel: " + channel + ")"))) { |
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.
"connection established, but session creation timed out. (channel: " + channel + ")"))) { | |
"connection established, but session creation timed out. (channel: " + channel + ')'))) { |
@kth496 Would you mind fixing the test failure in Window CI?
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6113 +/- ##
===========================================
+ Coverage 0 74.37% +74.37%
- Complexity 0 22172 +22172
===========================================
Files 0 1959 +1959
Lines 0 82262 +82262
Branches 0 10740 +10740
===========================================
+ Hits 0 61186 +61186
- Misses 0 15954 +15954
- Partials 0 5122 +5122 ☔ View full report in Codecov by Sentry. |
Thanks, @kth496! 👍 👍 👍 |
Motivation:
Adding the remoteAddress (i.e., the actual host, IP and port) to the exception message will help users understand which specific endpoint was involved in the failed negotiation.
ref: https://discord.com/channels/1087271586832318494/1087272728177942629/1341444142131183718
I appreciate any kind of feedback!
Modifications:
Result: