Skip to content

Conversation

@maskit
Copy link
Member

@maskit maskit commented Jun 27, 2019

H2 errors are logged only if they have error messages, and even with the messages, actual error codes are not logged.

We should log all errors with the codes at these places so that we can see what happened. If you don't want to log some particular errors for some reasons, you can skip these logging by passing nullptr as an error message (the default message is an empty string).

If everything is working well, amount of logs should not increase.

I'd like to backport this change to older versions because I think this is essential information for troubleshooting.

@maskit maskit added the HTTP/2 label Jun 27, 2019
@maskit maskit added this to the 9.0.0 milestone Jun 27, 2019
@maskit maskit self-assigned this Jun 27, 2019
@maskit maskit force-pushed the h2_log_errors_with_code branch from 59e7288 to ee1094a Compare June 27, 2019 03:35
if (error.msg) {
Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " stream_id=%u %s", client_ip,
ua_session->connection_id(), stream_id, error.msg);
Error("HTTP/2 connection error code=%d client_ip=%s session_id=%" PRId64 " stream_id=%u %s", static_cast<int>(error.code),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay.
Is it better to convert the code to string to log, so user don't need to search the source to find out what the actual meaning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm ok with using error names instead of codes. I'm not too worried about the log size but a line might get a bit too long, and making consistent length value might be easy to read (the maximum error code is 0x0d if we use hex).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it prints error codes in hex decimal. Let me know if you still want it to be a string error name.

@maskit maskit force-pushed the h2_log_errors_with_code branch from 37f5b33 to f2313eb Compare July 5, 2019 02:25
Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

@maskit
Copy link
Member Author

maskit commented Jul 5, 2019

[approve ci autest]

1 similar comment
@maskit
Copy link
Member Author

maskit commented Jul 5, 2019

[approve ci autest]

@maskit maskit merged commit 8510a1c into apache:master Jul 10, 2019
@zwoop zwoop modified the milestones: 9.0.0, 8.1.0 Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants