Don't bother logging IO errors caused by disappearing clients
If the client has broken off the network connection and that is why we are throwing an exception up at the caller, its not really an exception to be logged for the administrator. Its a fairly harmless case where the client started the network transfer, then just died. We should consider sending a patch upstream to MINA SSHD to try and use a more specific exception type here than just IOException, e.g. EOFException, or modify read to return -1. This might improve how we trap the exception, and eventually ignore it. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -180,11 +180,23 @@ abstract class AbstractCommand implements Command, SessionAware {
|
||||
try {
|
||||
run(args);
|
||||
} catch (IOException e) {
|
||||
if (e.getClass() == IOException.class
|
||||
&& "Pipe closed".equals(e.getMessage())) {
|
||||
// This is sshd telling us the client just dropped off while
|
||||
// we were waiting for a read or a write to complete. Either
|
||||
// way its not really a fatal error. Don't log it.
|
||||
//
|
||||
throw new UnloggedFailure(127, "error: client went away", e);
|
||||
}
|
||||
|
||||
throw new Failure(128, "fatal: unexpected IO error", e);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
throw new Failure(128, "fatal: internal server error", e);
|
||||
|
||||
} catch (Error e) {
|
||||
throw new Failure(128, "fatal: internal server error", e);
|
||||
|
||||
}
|
||||
} catch (Failure e) {
|
||||
if (!(e instanceof UnloggedFailure)) {
|
||||
|
Reference in New Issue
Block a user