so-called-hang-on-exit

Nicolas.Williams at ubsw.com Nicolas.Williams at ubsw.com
Wed Aug 7 00:12:04 EST 2002


Why are putting a timeout into the sshd's select() when flushing
the PTY?

I'll admit I've neither tried the patch nor really read it. But if
you'll rely on timeouts on one side, why not on the other. There's
the heuristic. I mean, if you want it to be totally correct then
sshd just has to wait for the pty to close - any other approach
has to be a heuristic and will allow for data lossage.

But then, you all seem to be happy with data lossage, whereas I'm
not happy to be forced to suffer it. So why not a client side
heuristic, like this:

if (session-exit && open_channels == 1) {
    set_timeout(1); /* 1 second - or as configured */
}
...

and in the event loop add a check for (open_sessions == 0 &&
open_channels == 1 && open_channel_has_pty()) and then close the
channel and do the right thing (exit).

Forgive my pseudo-code.

I mean, if we're gonna have a heuristic, why not put it on the
client side, where all users can decide whether or not to turn
it on (whereas they can't if the heuristic is implemented on
the server side - not without adding a special channel request
for it [ick!]).

Cheers,

Nico
-- 

> -----Original Message-----
> From: Frank Cusack [mailto:fcusack at fcusack.com]
> Sent: Tuesday, August 06, 2002 2:21 AM
> To: Williams, Nicolas
> Cc: jjaakkol at cs.Helsinki.FI; openssh-unix-dev at mindrot.org
> Subject: Re: so-called-hang-on-exit
> 
> 
> How does the client know the pty has been flushed and it's 
> not just that
> sshd has not set the right bit in the select mask (since it 
> does or does not
> set it according to some heuristic)?  ie, just b/c the client 
> isn't getting
> data doesn't mean the pty has been flushed.  Right?
> 
> /fc
> 
> On Mon, Aug 05, 2002 at 04:31:26PM -0400, 
> Nicolas.Williams at ubsw.com wrote:
> > 
> > Fair enough on the flushing of the pty. But sshd should still
> > not close the pty - it should wait for the background processes
> > to exit and/or dissassociate from the pty.
> > 
> > The client does know that there are background processes left
> > still holding the pty open. How? Because the client requested
> > and got a pty, the sshd has sent a session-exit message, and
> > the channel is still open.
> > 
> > Cheers,
> > 
> > Nico
> > -- 
> > 
> > > -----Original Message-----
> > > From: Jani Jaakkola [mailto:jjaakkol at cs.Helsinki.FI]
> > > Sent: Monday, August 05, 2002 4:20 PM
> > > To: Williams, Nicolas
> > > Cc: openssh-unix-dev at mindrot.org
> > > Subject: RE: so-called-hang-on-exit
> > > 
> > > 
> > > On Mon, 5 Aug 2002 Nicolas.Williams at ubsw.com wrote:
> > > 
> > > > 
> > > > I still think this sort of thing should be done by the client.
> > > > 
> > > > The client knows everything that the server knows.
> > > 
> > > Except this time is does not. If there is background 
> > > processses on the 
> > > tty, the client can either close the session and lose 
> data or wait 
> > > indefinetely for data from the background processes.
> > > 
> > > > So the client
> > > > can choose to terminate the SSHv2 session when the PTY session
> > > > process leader exits - and it can implement any other 
> termination
> > > > heuristic you wish too.
> > > 
> > > It needs server modifications that data from the pty 
> session process 
> > > leaders is not lost. I think rlogin and all other pty using 
> > > programs have 
> > > allready implemented this properly; which is that the pty 
> buffer is 
> > > first emptied and the connection is closed _after_ that.
> > > 
> > > - Jani
> 

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.




More information about the openssh-unix-dev mailing list