Bug 1758

Summary: client hangs when closing a multiplexed session with \n~.
Product: Portable OpenSSH Reporter: Maarten Billemont <lhunath>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm
Priority: P2    
Version: 5.4p1   
Hardware: Other   
OS: Mac OS X   
Bug Depends on:    
Bug Blocks: 1708    
Attachments:
Description Flags
send-close-on-mux-session-close.diff none

Description Maarten Billemont 2010-04-16 19:35:26 AEST
Initiate a ControlMaster session:

ssh -M foo

In a new terminal, start a new session that uses the ControlMaster connection:

ssh foo

Terminate the second by using the standard sequence "\n~.", the client will hang.  It will still respond to signals, but cannot be terminated from its terminal.  Eg. hitting ^C or ^Z has no effect (which, I recon, is not that surprizing as they don't affect the client process either while the connection is still active; they just get sent to the remote shell- that makes loosing the terminal no less annoying, though).

The only way to escape this situation and regain control over the controlling terminal is by opening another and signaling the ssh client or terminating the ControlMaster connection.
Comment 1 Damien Miller 2010-04-17 17:02:46 AEST
Created attachment 1839 [details]
send-close-on-mux-session-close.diff

Unblock sending of SSH2_MSG_CHANNEL_CLOSE on mux sessions
Comment 2 Damien Miller 2010-04-17 17:03:26 AEST
I think this patch should fix it, but I need to test a few corner cases.
Comment 3 Damien Miller 2010-04-24 08:28:09 AEST
patch applied, this will be in OpenSSH-5.6. Thanks for the report.
Comment 4 Damien Miller 2011-01-24 12:34:06 AEDT
Move resolved bugs to CLOSED after 5.7 release