-
Notifications
You must be signed in to change notification settings - Fork 664
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
Don't crash on "Connection reset by peer" #1954
Conversation
#1887 introduced `expect("Decoder error")` which was incorrect because Decoder error is not the only error case for FramedRead stream: error could come from the underlying tcp stream. The old behavior was to ignore the error, the behavior with this change is to print the error and stop the stream.
chain/network/src/peer_manager.rs
Outdated
.take_while(|x| match x { | ||
Ok(_) => future::ready(true), | ||
Err(e) => { | ||
error!(target: "network", "Peer stream error: {:?}", e); |
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.
If the peer stream closes I don't think there is a need to log in error!
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.
We should at least log in warn
since this is not expected behavior. I agree that this is not an error in this node, but about node in the other side.
Codecov Report
@@ Coverage Diff @@
## staging #1954 +/- ##
===========================================
+ Coverage 86.61% 86.66% +0.05%
===========================================
Files 167 167
Lines 31488 31659 +171
===========================================
+ Hits 27273 27437 +164
- Misses 4215 4222 +7
Continue to review full report at Codecov.
|
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.
Use warn
instead of error
while logging.
* Don't crash on "Connection reset by peer" #1887 introduced `expect("Decoder error")` which was incorrect because Decoder error is not the only error case for FramedRead stream: error could come from the underlying tcp stream. The old behavior was to ignore the error, the behavior with this change is to print the error and stop the stream. * warn instead of error Co-authored-by: Alexander Skidanov <[email protected]>
#1887 introduced
expect("Decoder error")
which was incorrect because Decoder error isnot the only error case for FramedRead stream: error could come from the
underlying tcp stream.
The old behavior was to ignore the error, the behavior with this change
is to print the error and stop the stream.