Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Peer disconnects should not result in stack traces. #818

Merged
merged 5 commits into from
Feb 9, 2019

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Feb 8, 2019

PR description

Replace two known stack traces an info level. Replace with a single
debug line because disconnects are basically expected.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else if (rootCause instanceof PeerDisconnectedException) {
} else if (rootCause instanceof EthTaskException) {
LOG.debug(rootCause.getMessage());
}

Copy link
Contributor

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.

Copy link
Contributor Author

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());
Copy link
Contributor Author

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)
Copy link
Contributor

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?

@shemnon shemnon merged commit 7ab5f60 into PegaSysEng:master Feb 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants