rpwoodbu / mosh-chrome

Mosh for Chrome
GNU General Public License v3.0
372 stars 59 forks source link

Mosh-Chrome does not disconnect when session closed? #107

Closed computersarecool closed 9 years ago

computersarecool commented 9 years ago

This may not be a problem with the extension so forgive me if I am missing something.

However, when I run who, each time I close a mosh window and reconnect I see that another user, with another PID, is listed as logged into my machine as opposed to the same user.

Is this what is supposed to happen?

keithw commented 9 years ago

What version of mosh-server is installed on the server?

Does the problem still happen if you "exit" the session explicitly from within it, instead of just closing the mosh window?

computersarecool commented 9 years ago

Running mosh -v returns 1.2.5

I realized now that "exiting" the sessions explicitly from within it instead of just closing the mosh window does indeed fix the problem. Is the best practice to just try to do this? I am not sure if having these other sessions around is even problematic (perhaps you can advise?)

Also, I just noticed that you wrote mosh. Thank you, I find it awesome.

keithw commented 9 years ago

Thanks! Could you please try running mosh-server on the server? That will give you the version number of the server.

computersarecool commented 9 years ago

Here is the output of that:

mosh-server (mosh 1.2.5) [build mosh 1.2.5]

Also, not sure if this has anything to do with it, not sure how it could, but I am running tmux and connect to tmux each time a mosh session is started.

rpwoodbu commented 9 years ago

Bad behavior when closing the window directly (i.e., via the "X" button) is a long-standing problem with Mosh for Chrome; see Issue #5. One point I didn't quite make in that issue (I will update it) is that the NaCl process is killed forcibly, without giving it a chance to signal to the server that the session should be torn down.

The workaround is just to be sure to close the session naturally (via a proper shell exit), or if necessary, to use the Ctrl-^ . sequence. It is bad practice to leave "stranded" mosh-servers running on your system, so it is best to avoid it, but they are "mostly harmless". The reality is that it is not 100% avoidable, since the client side could crash. This is why mosh shows you "stranded" sessions when you connect again, giving you the opportunity to clean house. I have a script I call instead of mosh-server that helps keep this clean; I have been meaning to share it, and will do so some day. :)

I'll continue the discussion in Issue #5.

computersarecool commented 9 years ago

Sorry I missed that thread. Thanks for your clear explanation and addressing my questions - most excellent. I will follow #5 Thanks!