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

fix(net): Avoid a rare panic when a connection is dropped #6566

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions zebra-network/src/peer/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,13 @@ impl Service<Request> for Client {
Ok(()) => {
// The receiver end of the oneshot is itself a future.
rx.map(|oneshot_recv_result| {
oneshot_recv_result
.expect("ClientRequest oneshot sender must not be dropped before send")
// The ClientRequest oneshot sender should not be dropped before sending a
// response. But sometimes that happens during process or connection shutdown.
// So we just return a generic error here.
match oneshot_recv_result {
Ok(result) => result,
Err(oneshot::Canceled) => Err(PeerError::ConnectionDropped.into()),
}
})
.boxed()
}
Expand Down