[CRIU] Dumping tmux session with a client connected

Allan Cecil ac at sonic.net
Mon Apr 13 13:52:06 PDT 2015


On 04/13/2015 10:50 AM, Cyrill Gorcunov wrote:
> On Mon, Apr 13, 2015 at 10:31:47AM -0700, Allan Cecil wrote:
> ...
>>   733 ?        Ss     0:00 /usr/sbin/sshd -D
>> 11788 ?        Ss     0:00  \_ sshd: ac [priv]     
>> 11811 ?        S      0:01  |   \_ sshd: ac at pts/1      
>> 11812 pts/1    Ss+    0:00  |       \_ -bash
>> 16050 ?        Ss     0:00  \_ sshd: ac [priv]     
>> 16070 ?        S      0:00  |   \_ sshd: ac at pts/2      
>> 16071 pts/2    Ss+    0:00  |       \_ -bash
>> 16411 ?        Ss     0:00  \_ sshd: ac [priv]     
>> 16430 ?        S      0:00  |   \_ sshd: ac at pts/3      
>> 16431 pts/3    Ss     0:00  |       \_ -bash
>> 16447 pts/3    S+     0:00  |           \_ tmux
>> 16448 pts/3    Z+     0:00  |               \_ [tmux] <defunct>
>> 16465 ?        Ss     0:00  \_ sshd: ac [priv]     
>> 16484 ?        S      0:00      \_ sshd: ac at pts/5      
>> 16485 pts/5    Ss     0:00          \_ -bash
>> 16499 pts/5    R+     0:00              \_ ps afx
>>   779 ?        Ss     0:00 cron
>>   809 tty1     Ss+    0:00 /sbin/getty -8 38400 tty1
>>   816 ?        Ss     0:20 /usr/sbin/irqbalance
>> 15349 ?        Ss     0:00 criu service -d
>> 16449 ?        Ss     0:00 tmux
>> 16450 pts/4    Ss     0:00  \_ -bash
>> 16464 pts/4    S+     0:00      \_ top
> 
> So here are two tmux instances and sockets looks like socket from
> firts tmux (16447) is sneaked into the tmux you're trying to dump.
> If you run only one instance of tmux, does it help?

There is only one instance of tmux running.  I confirmed by doing ps fax | grep tmux before simply launching tmux at the shell with no arguments.  What you're seeing is the client.  This may make more sense - first, here's all of the tmux sessions currently running:

$ ps fax | grep tmux
16447 pts/3    S+     0:00  |           \_ tmux
16448 pts/3    Z+     0:00  |               \_ [tmux] <defunct>
16602 pts/2    S+     0:00              \_ grep --color=auto tmux
16449 ?        Ss     0:12 tmux

Next, I'll disconnect the client in the other terminal (Ctrl+B d to detach from the tmux view running top) and check ps again:

16604 pts/2    S+     0:00              \_ grep --color=auto tmux
16449 ?        Ss     0:12 tmux

Now only the tmux server remains as the client has disconnected; in this state, dumping 16449 will succeed because there is no client attached.  Now, type tmux attach in the other terminal and a new process starts:

16605 pts/3    S+     0:00  |           \_ tmux attach
16607 pts/2    S+     0:00              \_ grep --color=auto tmux
16449 ?        Ss     0:12 tmux

Dumping 16449 will now fail with the error in the logs.  The goal is to be able to dump while a client is attached, preferably with the --leave-running flag set, and later restore the server and allow a client to connect to it (this would be handled automatically by my python script).  Since dumping a tmux session with a client attached always fails, I'm pursuing a method where I launch two tmux instances and completely detach all clients from the "inner" session so the dump succeeds, but this is less preferable because it will cause a lot of noise on the terminal compared to the existing KVM method.  Having said all that, it might be not worthwhile to try to make this use case work. :)

Thanks again for your time and let me know what you think,

A.C.
******


More information about the CRIU mailing list