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
ZOOKEEPER-2893. very poor choice of logging if client fails to connect to server #430
Changes from 1 commit
fbe4ccd
6ea4cb2
47a8cf4
aa73554
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1041,6 +1041,8 @@ private void sendPing() { | |
|
||
private InetSocketAddress rwServerAddress = null; | ||
|
||
private InetSocketAddress addr = null; | ||
|
||
private final static int minPingRwTimeout = 100; | ||
|
||
private final static int maxPingRwTimeout = 60000; | ||
|
@@ -1063,7 +1065,6 @@ private void startConnect() throws IOException { | |
} | ||
state = States.CONNECTING; | ||
|
||
InetSocketAddress addr; | ||
if (rwServerAddress != null) { | ||
addr = rwServerAddress; | ||
rwServerAddress = null; | ||
|
@@ -1232,11 +1233,12 @@ public void run() { | |
} else if (e instanceof RWServerFoundException) { | ||
LOG.info(e.getMessage()); | ||
} else { | ||
SocketAddress remoteAddr = clientCnxnSocket.getRemoteSocketAddress(); | ||
LOG.warn( | ||
"Session 0x" | ||
+ Long.toHexString(getSessionId()) | ||
+ " for server " | ||
+ clientCnxnSocket.getRemoteSocketAddress() | ||
+ (remoteAddr == null ? addr : remoteAddr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that, if If so, then this could be simplified to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course this comment is [non-blocking] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. I'll just use 'addr' here. |
||
+ ", unexpected error" | ||
+ RETRY_CONN_MSG, e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good to address the other issue Paul mentioned - no need to dump a stack if we know this is NoRouteToHostException - why wouldn't we add another elseif to check for this type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're talking about the same thing in the Jira. It's arguable which exception should be logged at INFO level without the stack trace, I ended up separating SocketExceptions altogether and leaving the rest for the original handler. |
||
} | ||
|
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.
[non-blocking]
The name could be an ambiguous: is this the address of the local (client) side of the connection, or the remote (server) side of the connection? Especially as there is
rwServerAddress
field member defined immediately above.Suggest
serverAddress
(or similar)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.
Remote side of the connection. Basically the ip address that the client is trying to connect to.
rwServerAddress
is the address of non-R/O server found if there's any.I'll change this to
serverAddress
.