[CRIU] Dumping of stream unix connection

Pavel Emelyanov xemul at parallels.com
Thu Jun 4 06:42:48 PDT 2015


> Hi all,
> 
> We're returned back at this problem..

Cool :)

>>     >     > The usage scenario is following: I'm having a parent process and a child processes bidirectonal communicating
>>     >     > via stream Unix socket. The idea is to dump child process when it's not needed and to restore it
>>     >     > again later
> 
> This task still need for us and we did some test with upstream version of CRIU.
> Code of test stub here -> http://pastebin.com/tLnRdE3K
> CRIU called with next params:
> for dump -> ${CRIU_bin} dump -vvvv -o <PID>.log -D ${DIR} -t <PID> -d --shell-job --ext-unix-sk
> for restore -> ${CRIU_bin} restore -vvvv -o <PID>.log -D ${DIR}  -d --shell-job --ext-unix-sk
> 
> Test case: child write in a unix sock, parent read from unix sock.
> Child proccess dumped&restored, but
>  - only if we don't close sockets after fork (sock[0] in child and sock[1] in parent respectively) otherwise restore process failed

Can you share the restore logs?

>  - child PPID not equal parent pid 
>  - connection lost
> 
> P.S. Also we are checked pipes (instead of socketpair)
> Test case 1: child write in a pipe, parent read from pipe. 
> Child proccess dumped&restored, but
>  - child PPID not equal parent pid 
>  - connection lost with another end of pipe(continue sending messages into pipe)
> Test case 2: child read in a pipe, parent write from pipe. 
> As expected parent received SIGPIPE.
> 
> Sumary questions:
> 1. Can we restored relation (subtree) between parent and child process?

Yes, for this the parent should call criu restore with the --restore-sibling option. Or 
use the criu_restore_child() library call. If you call restore from a non-parent process,
then the linkage will not be restored, there's no such API in the kernel.

But hmm... this, in theory, can be implemented by putting the parasite into the parent,
then calling fork_with_pid() from it and continuing restore. Need to think about it...

> 2. Do you have a plan for imp of dump\restore functionality for unix sockets with
> option SOCK_SEQPACKET and SOCK_STREAM (created by socketpair call) in near time?

You mean external sockets? Well, I have plan how to do it, but can't guarantee you
whether I will be able to allocate time for it. If you'll be able to do it, then
contributions are welcome :) and from my side I can guarantee the necessary level
of advises, comments and review.

> 3. Do you have any ideas which can help us make a dump\restore of child proccess with CRIU?

Not sure I understand this correctly, would you describe in more details, please?

-- Pavel



More information about the CRIU mailing list