From 93048763ca862e46d71262ae9af232a24d95b1d6 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 12 May 2022 16:04:26 +0200 Subject: [PATCH] Add a message for EOF-related broken pipe errors It's quite confusing from production logs when all I get is "broken pipe" and I don't know which path was taken for that error to be logged. --- src/proto/streams/state.rs | 5 ++++- src/proto/streams/streams.rs | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/proto/streams/state.rs b/src/proto/streams/state.rs index 9931d41b..91119178 100644 --- a/src/proto/streams/state.rs +++ b/src/proto/streams/state.rs @@ -303,7 +303,10 @@ impl State { Closed(..) => {} ref state => { tracing::trace!("recv_eof; state={:?}", state); - self.inner = Closed(Cause::Error(io::ErrorKind::BrokenPipe.into())); + self.inner = Closed(Cause::Error(io::Error::new( + io::ErrorKind::BrokenPipe, + "stream closed because of broken pipe", + ).into())); } } } diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs index 3e7ae97d..fbf6b3ec 100644 --- a/src/proto/streams/streams.rs +++ b/src/proto/streams/streams.rs @@ -807,7 +807,13 @@ impl Inner { let send_buffer = &mut *send_buffer; if actions.conn_error.is_none() { - actions.conn_error = Some(io::Error::from(io::ErrorKind::BrokenPipe).into()); + actions.conn_error = Some( + io::Error::new( + io::ErrorKind::BrokenPipe, + "connection closed because of broken pipe", + ) + .into(), + ); } tracing::trace!("Streams::recv_eof");