8000 proxy/client: do not print error on EOF by xhebox · Pull Request #90 · pingcap/tiproxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 4 commits into from
Sep 23, 2022
Merged

Conversation

xhebox
Copy link
Collaborator
@xhebox xhebox commented Sep 21, 2022

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox requested a review from djshow832 September 21, 2022 08:18
Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox requested a review from djshow832 September 22, 2022 03:05
Signed-off-by: xhe <xw897002528@gmail.com>
@@ -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)) {
Copy link
Collaborator

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.

Copy link
Collaborator Author
@xhebox xhebox Sep 23, 2022

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.

Copy link
Collaborator Author
@xhebox xhebox Sep 23, 2022

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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>
@djshow832 djshow832 merged commit 0354249 into pingcap:main Sep 23, 2022
@xhebox xhebox deleted the minor_2 branch September 23, 2022 06:58
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 7, 2023
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0