-
Notifications
You must be signed in to change notification settings - Fork 130
Peer disconnects should not result in stack traces. #818
Conversation
Replace two known an info level stack trace would occur with a single debug line because disconnects are basically expected.
@@ -105,6 +106,10 @@ public ChainDownloader( | |||
LOG.trace("Download cancelled", t); | |||
} else if (rootCause instanceof InvalidBlockException) { | |||
LOG.debug("Invalid block downloaded", t); | |||
} else if (rootCause instanceof PeerDisconnectedException) { |
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.
} else if (rootCause instanceof PeerDisconnectedException) { | |
} else if (rootCause instanceof EthTaskException) { | |
LOG.debug(rootCause.getMessage()); | |
} |
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.
While you're at it, you could probably just handle all EthTaskException
's ^ as those are "expected" exceptions. It seems that LOG.error
below should be there to catch unexpected exceptions.
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.
Yep. We don't need stack traces when we fail in expected ways.
These exceptions fall into the category of flow control instead of errors, hence the lack of stacktrace.
@@ -105,6 +106,8 @@ public ChainDownloader( | |||
LOG.trace("Download cancelled", t); | |||
} else if (rootCause instanceof InvalidBlockException) { | |||
LOG.debug("Invalid block downloaded", t); | |||
} else if (rootCause instanceof EthTaskException) { | |||
LOG.debug(rootCause.toString()); |
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.
toString is deliberate, to show we are not attempting to log the throwable.
@@ -550,7 +550,7 @@ public void recoversFromSyncTargetDisconnect() { | |||
// Downloader should recover and sync to next best peer, but it may stall | |||
// for 10 seconds first (by design). | |||
await() | |||
.atMost(20, TimeUnit.SECONDS) | |||
.atMost(30, TimeUnit.SECONDS) |
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.
Did you mean to include this change here?
PR description
Replace two known stack traces an info level. Replace with a single
debug line because disconnects are basically expected.