Skip to content

Commit

Permalink
Add a message for EOF-related broken pipe errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nox committed May 12, 2022
1 parent 3a0c622 commit 8b1f01b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/proto/streams/state.rs
Expand Up @@ -303,7 +303,13 @@ 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(),
));
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/proto/streams/streams.rs
Expand Up @@ -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");
Expand Down

0 comments on commit 8b1f01b

Please sign in to comment.