hive-c0re, hive-priv: demote three routine, non-actionable log sites
This commit is contained in:
parent
77034a7c9c
commit
25893d0f95
3 changed files with 46 additions and 3 deletions
|
|
@ -58,7 +58,15 @@ pub fn start(agent: &str, socket_path: &Path, coord: Arc<Coordinator>) -> Result
|
|||
let coord = coord.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = serve(stream, agent, coord).await {
|
||||
tracing::warn!(error = ?e, "agent connection failed");
|
||||
// A peer closing its end mid-read/write (the harness
|
||||
// process exiting, a turn ending) is routine and the
|
||||
// overwhelming majority of what reaches here —
|
||||
// demoted so it doesn't bury a genuine failure.
|
||||
if is_broken_pipe(&e) {
|
||||
tracing::debug!(error = ?e, "agent connection closed by peer");
|
||||
} else {
|
||||
tracing::warn!(error = ?e, "agent connection failed");
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -201,6 +209,18 @@ async fn read_request_line<R: AsyncBufRead + Unpin>(
|
|||
})
|
||||
}
|
||||
|
||||
/// Whether `e`'s root cause is the peer closing the connection — `serve`'s
|
||||
/// own `?`s convert a raw `std::io::Error` straight to `anyhow::Error` with
|
||||
/// no intervening `.context()`, so a direct downcast reaches it.
|
||||
fn is_broken_pipe(e: &anyhow::Error) -> bool {
|
||||
e.downcast_ref::<std::io::Error>().is_some_and(|io_err| {
|
||||
matches!(
|
||||
io_err.kind(),
|
||||
std::io::ErrorKind::BrokenPipe | std::io::ErrorKind::ConnectionReset
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// Answer each request line on `stream` until EOF. An over-long line gets a
|
||||
/// `Response::Err` and then the connection is closed, because the rest of the
|
||||
/// line is still unread.
|
||||
|
|
|
|||
Loading…
Reference in a new issue