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:
Shawn O. Pearce
2009-02-17 18:49:42 -08:00
parent 4a7f6fa444
commit 2335b6dd60

View File

@@ -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)) {