-
Notifications
You must be signed in to change notification settings - Fork 31
proxy/client: do not print error on EOF #90
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
Conversation
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
pkg/proxy/client/client_conn.go
Outdated
@@ -77,7 +81,10 @@ func (cc *ClientConnection) Run(ctx context.Context) { | |||
} | |||
|
|||
if err := cc.processMsg(ctx); err != nil { | |||
cc.logger.Info("process message fails", zap.String("remoteAddr", cc.Addr()), zap.Error(err)) | |||
clientErr := errors.Is(err, ErrClientConn) | |||
if !(clientErr && pnet.IsDisconnectError(err)) { |
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.
If clientErr && pnet.IsDisconnectError(err) == true
, it's still not printed.
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.
So why not ignore client disconnect
errors? Even if you print it out, you still need to search all files to conclude that there is no server disconnect
error by realizing all errors are from client
.
I'll give another modification, EOF
is a normal disconnection state that should be ignored. And broken pipe
or connection reset
will be logged. Then, normal client disconnection will not log errors, but abnormal disconnections do.
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.
BTW, there is another argument. Since server will nerver end the connection in the command phase, thus disconnection must come from clients or network errors. Now all network errors are logged. If no errors are logged, then it is disconnected byEOF
from clients obviously.
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.
I don't think EOF
is normal. Sending a STMT_QUIT
is normal.
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 came up to me that there's always another disconnection log. So ignoring the EOF
may be fine.
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe xw897002528@gmail.com
What problem does this PR solve?
Issue Number: close None
Problem Summary: Another logging improvement.
EOF
is normal and should be seen as error.What is changed and how it works:
Check List
Tests
Notable changes
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.