How to figure out why ssh session does not exit sometimes?
- by WilliamKF
I have a C++ application that uses ssh to summon a connection to the server.  I find that sometimes the ssh session is left lying around long after the command to summon the server has exited.  Looking at the Centos4 man page for ssh I see the following:
 The session terminates when the command or shell on the remote machine
 exits and all X11 and TCP/IP connections have been closed.  The exit
 status of the remote program is returned as the exit status of ssh.
I see that the command has exited, so I imagine not all the X11 and TCP/IP connections have been closed.  How can I figure out which of these ssh is waiting for so that I can fix my summon command's C++ application to clean up whatever is being left behind that keeps the ssh open.
I wonder why this failure only occurs some of the time and not on every invocation?  It seems to occur approximately 50% of the time.  What could my C++ application be leaving around to trigger this?