Skip to content
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

2004 reduce logging bigints #2406

Merged
merged 9 commits into from
Jun 14, 2021

Conversation

jflo
Copy link
Contributor

@jflo jflo commented Jun 10, 2021

PR description

Avoids logging (potentially large) corrupt HELLO messages when connecting with peers.

Fixed Issue(s)

fixes #2004

Changelog

Failures to parse HELLO now include byte length differences on nodeId in the exception message, as well as guidance to adjust the debug level to trace if user is really interested in seeing the entire peerInfo.

@jflo
Copy link
Contributor Author

jflo commented Jun 10, 2021

I'm considering updating the DeFramer unit test to mock out the logger and check that it is called as expected in cases of valid and invalid HELLOs

Justin Florentine added 3 commits June 10, 2021 13:27
@jflo jflo force-pushed the 2004-Reduce-logging-bigints branch from aecd26d to 7dff2ad Compare June 10, 2021 17:28
Signed-off-by: Justin Florentine <[email protected]>
@jflo jflo force-pushed the 2004-Reduce-logging-bigints branch from a4f9dae to 4da65d8 Compare June 10, 2021 18:46
@jflo jflo marked this pull request as ready for review June 10, 2021 20:24
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

🚢

@@ -109,12 +109,12 @@ protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final L
try {
peerInfo = HelloMessage.readFrom(message).getPeerInfo();
} catch (final RLPException e) {
LOG.debug("Received invalid HELLO message", e);
LOG.warn("Received invalid HELLO message, set log level to TRACE for message body", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that passing this log in warning does not risk spamming the logs of a node running on the mainnet or on ropsten etc ? Do we often receive invalid messages of this type ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point. I looked at log aggregation for all of our canaries and only see 1 occurrence of this exception. This should not result in logspam at warn instead of debug.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok 👍

@garyschulte garyschulte enabled auto-merge (squash) June 14, 2021 21:31
@garyschulte garyschulte merged commit e94c526 into hyperledger:master Jun 14, 2021
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* seems like a reasonable use for TRACE level instead of DEBUG
* hint to user they should adjust logging if they really want to see the body of the corrupt HELLO
* include actual nodeId length in error message
Signed-off-by: Justin Florentine <[email protected]>

Co-authored-by: Justin Florentine <[email protected]>
Co-authored-by: matkt <[email protected]>
Co-authored-by: garyschulte <[email protected]>
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.

Reduce logging of big ints
3 participants