[CentOS] [OT} Odd tmux behaviour on exit

Mon Dec 15 16:11:07 UTC 2014
James B. Byrne <byrnejb at harte-lyne.ca>

CentOS-6.6
tmux-1.6 (epel)

Twice now I have experienced the situation where upon exiting from a tmux
initiated session on a remote host instead of returning to the originating
session I see this in the session terminal display:

<pre>
················································································
·································<infinite>·····································
. . .
<infinite lines of dots>
. . .

·································<infinite>·····································
················································································
<pre>

If I resize the terminal window then the dots expand to fill the available
display.  The scroll-back is not affected.  I am unable to regain control of
that terminal session from within the session itself.

Looking at the processes runnin on that host from a direct ssh session shows
this:

<pre>
# ps -ef | grep ssh
root      1502     1  0 Dec12 ?        00:00:06 /usr/sbin/sshd
root     10798  1502  0 10:00 ?        00:00:09 sshd: root at pts/0
root     13015 10810  0 10:12 pts/1    00:00:08 ssh inet07 -t -Y tmux ||
/bin/bash
root     13017  1502  0 10:12 ?        00:00:08 sshd: root at pts/2
root     15622  1502  0 10:45 ?        00:00:00 sshd: root
root     16033  1502  1 10:47 ?        00:00:00 sshd: root at pts/3
root     16099 16038  3 10:48 pts/3    00:00:00 grep ssh
[root at inet07 ~]# ps -ef | grep 10810
root     10810 10809  0 10:00 pts/1    00:00:00 -bash
root     13015 10810  0 10:12 pts/1    00:00:08 ssh inet07 -t -Y tmux ||
/bin/bash
root     16113 16038  0 10:48 pts/3    00:00:00 grep 10810
[root at inet07 ~]# ps -ef | grep 10809
root     10809     1  0 10:00 ?        00:00:03 tmux
root     10810 10809  0 10:00 pts/1    00:00:00 -bash
root     16115 16038  3 10:48 pts/3    00:00:00 grep 10809
</pre>


pts/3 is the diect ssh connection.  pts/1 appears to be the tmux session
instigated from the ssh login pts/2.  I am guessing that the problem is
somewhere in the shutdown of pts/1.

If I kill 13015 (pts/1) from the direct ssh connection then I return control
of the tmux session back to the terminal and I remain logged on to the remote
host.  If I then exit the remote host I return to the original host as
expected.

Tmux is called from the original session using a function named sshtn as
defined below:

# declare -f
sshta ()
{
    ssh "$*" -t -Y 'tmux a || tmux || /bin/bash'
}
sshtn ()
{
    ssh "$*" -t -Y 'tmux || /bin/bash'
}


Anyone have any ideas on what might be causing this; and is there any way of
preventing it?  In this instance I had opened an X-Window application (gvim)
in the remote tmux instance and had subsequently shut that down prior to
exiting.  Nonetheless, I am wondering if that has anything to do with the
situation.


-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3

-- 
***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3