[CRIU] Dumping of stream unix connection

Pavel Emelyanov xemul at parallels.com
Thu Jun 4 13:30:22 PDT 2015


On 06/04/2015 07:35 PM, Artem Kuzmitskiy wrote:
> 
> 
> 2015-06-04 16:42 GMT+03:00 Pavel Emelyanov <xemul at parallels.com <mailto:xemul at parallels.com>>:
> 
>     > 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?
> 
> 
> yes sure:
> test stub -> http://pastebin.com/iBuQy0CL
> dump log -> http://pastebin.com/9ysvQ69m
> restorel log ->  http://pastebin.com/HR459Diu

Heh :) This is external dgram socket w/o a name. Can happen if it's a socketpair, but
criu errorneously tries to connect() them back. Bug in CRIU, thanks!

>     > 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?
> 
> 
> We have parent process which forks few child processes and exchange with child processes using pair of sockets returned from socketpair(with option SOCK_SEQPACKET or SOCK_STREAM).
> We would like to dump child(s) and  full-featured restore them.

Ah, I see. Such sockets should be dumped and restored using the --inherit-fd option [1].
We don't yet have it working with unix sockets, only regular files and pipes, but adding
unix sockets should be not extremely hard.

[1] http://criu.org/Inheriting_FDs_on_restore


-- Pavel



More information about the CRIU mailing list