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

Don't crash on "Connection reset by peer" #1954

Merged
merged 5 commits into from
Jan 15, 2020
Merged

Don't crash on "Connection reset by peer" #1954

merged 5 commits into from
Jan 15, 2020

Conversation

mikhailOK
Copy link
Contributor

#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.

#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.
.take_while(|x| match x {
Ok(_) => future::ready(true),
Err(e) => {
error!(target: "network", "Peer stream error: {:?}", e);
Copy link
Collaborator

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!

Copy link
Member

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

codecov bot commented Jan 14, 2020

Codecov Report

Merging #1954 into staging will increase coverage by 0.05%.
The diff coverage is 75.54%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
near/tests/rpc_nodes.rs 95.14% <0%> (+0.07%) ⬆️
chain/network/tests/runner/mod.rs 96.12% <100%> (+0.01%) ⬆️
chain/client/src/client_actor.rs 87.45% <100%> (+1.21%) ⬆️
near/src/lib.rs 98.21% <100%> (+0.03%) ⬆️
chain/chain/src/chain.rs 90.53% <100%> (ø) ⬆️
chain/network/src/peer_manager.rs 76.57% <100%> (-1.13%) ⬇️
chain/network/src/types.rs 76.43% <100%> (+1.03%) ⬆️
chain/client/src/test_utils.rs 80.5% <45.45%> (+0.21%) ⬆️
chain/client/src/view_client.rs 69.01% <77.38%> (+3.31%) ⬆️
chain/network/src/peer.rs 75% <79.06%> (+0.29%) ⬆️
... and 47 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fbe7be0...8f743eb. Read the comment docs.

Copy link
Member

@mfornet mfornet left a 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.

@mikhailOK mikhailOK merged commit 66ac6a2 into staging Jan 15, 2020
@mikhailOK mikhailOK deleted the decoder_error branch January 15, 2020 21:34
SkidanovAlex added a commit that referenced this pull request Jan 29, 2020
* 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]>
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.

5 participants