[CRIU] Dumping of stream unix connection

Artem Kuzmitskiy artem.kuzmitskiy at gmail.com
Thu Jun 4 03:42:40 PDT 2015


>
> On 03/27/2015 07:27 PM, Anatoly Baranov wrote:
> >
> > 2015-03-25 17:08 GMT+03:00 Pavel Emelyanov <xemul at parallels.com <mailto:
> xemul at parallels.com>>:
> >
> >     On 03/25/2015 05:00 PM, Anatoly Baranov wrote:
> >     >
> >     > 2015-03-25 15:57 GMT+03:00 Pavel Emelyanov <xemul at parallels.com
> <mailto:xemul at parallels.com> <mailto:xemul at parallels.com <mailto:
> xemul at parallels.com>>>:
> >     >
> >     >     On 03/25/2015 01:46 PM, Анатолий Баранов wrote:
> >     >     > Hi all,
> >     >     > I found that there are troubles with dumping of stream Unix
> connection: when I'm trying to
> >     >     > checkpoint it, I'm receiving "Can't dump half of stream Unix
> connection" message.
> >     >     > I've found this thread:
> http://lists.openvz.org/pipermail/criu/2013-June/009320.html but it
> >     >     > didn't help.
> >     >     > The usage scenario is following: I'm having a parent process
> and a child processes communicating
> >     >     > via stream Unix socket. The idea is to dump child process
> when it's not needed and to restore it
> >     >     > again later,
> >     >
> >     >     But what to do with this connection upon restore?
> >     >
> >     > Sorry, but I'm afraid, I didn't understand you question. I
> intended to continue sending streamed data
> >     > from the point where it was dumped. Did you mean I won't be able
> to use the connection after I restore it?
> >
> >     Well, child will be able to do it, but what about parent? Once you
> dumped the child
> >     and killed one parent would notice the EOF on the socket and will
> close it. So after
> >     restore of child there will be no "peer" to send data to.
> >
> >
> > Hi again,
> >
> > I can see few hypothetical possibilities here:
> > 1) I can try to keep the socket in parent process alive if possible. For
> example, I can try to not to send EOF from the child process.
>
> You can't force child not to send EOF :) Kernel will do it for you once
> child is
> dumped AND killed afterwards.
>
> > 2) I can try to embed criu in parent process and build logic around it,
> for example re-open parent socket when restoring child.
>
> Well, if you control the parent, then this situation can be resolved.
> What you're
> trying to achieve seems to be the case for FD inheritance on restore
> [1]. We have
> it implemented for pipes and regular files only, so we'll need to
> extend that logic
> on unix sockets as well :)
>
> [1] http://criu.org/Inheriting_FDs_on_restore
>
> -- Pavel
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>


Hi all,

We're returned back at this problem..

>     >     > 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
 - 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?
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?
3. Do you have any ideas which can help us make a dump\restore of child
proccess with CRIU?

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


More information about the CRIU mailing list