[CRIU] Dumping of stream unix connection

Artem Kuzmitskiy artem.kuzmitskiy at gmail.com
Thu Jun 4 09:35:07 PDT 2015


2015-06-04 16:42 GMT+03:00 Pavel Emelyanov <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


> >  - 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...


Ok, thx. We'll check this option.


>




> > 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.


Thx, I'll discuss with my team and give you know.

>
> > 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.

>
> -- Pavel
>
>


-- 
Best regards,
Artem Kuzmitskiy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150604/b4fd9a00/attachment.html>


More information about the CRIU mailing list