[Techtalk] Re: Techtalk digest, Vol 1 #429 - 1 msg
Malcolm Tredinnick
malcolm at commsecure.com.au
Sun Apr 7 09:35:51 EST 2002
On Sat, Apr 06, 2002 at 11:52:28AM -0500, David Merrill wrote:
[...]
> Here's what displayed when the connection closed:
>
>
> debug1: channel_free: channel 0: client-session, nchannels 1
> Read from remote host pan: Connection reset by peer
> Connection to pan closed.
> debug1: Transferred: stdin 0, stdout 0, stderr 80 bytes in 3452.2
> seconds
> debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
> debug1: Exit status -1
> david at syrinx:~$
>
>
> No clues that I can see. :-/
My understanding from reading this and the last post is that nothing is
wrong. An attempt at an explanation follows:
KeepAlive is probably slightly misnamed in ssh. It really functions as a
"detect if I'm dead and terminate" and does actually keep your session
alive. :-( The option exists so that you know _immediately_ if there is
a hiccough in the middle of the route between your end points. How it
does this without actually keeping the link active is beyond my ken, but
the behaviour being talked about in this thread is pretty common and not
considered unusual (apparently). I guess that since OpenSSH has the
source code available, I could just look it up. But then I'd have to
hand in my "lazy so and so" t-shirt.
I've seen the same problem David is experiencing a number of times;
almost always over long or slightly dodgy connections. Some machine in
the middle will decide that I haven't been sending any traffic for a
while and will terminate the connection. This seems to particularly
happen when one of the immediate machines is doing NAT, since they reap
their outstanding, seemingly idle connections every now and again.
In my own case, to get around this I put the following little script in
the background as part of my .bash_login on the remote machines:
--------------------------------------------
#!/usr/bin/env python
import time, sys
# Keep a session from timing out by sending NUL characters periodically.
while 1:
time.sleep(30)
sys.stderr.write("\000")
--------------------------------------------
This prints nothing on the screen, but it does send a few bytes every
thirty seconds over the link and keeps things going. On some machines,
logging out doesn't always kill the above script, so I sometimes have
had to put in .bash_logout magic as well, but that is getting rarer.
Cheers,
Malcolm
--
More information about the Techtalk
mailing list