[CRIU] pstree C/R problems

Huang Qiang h.huangqiang at huawei.com
Thu Sep 27 07:36:16 EDT 2012


On 2012/9/27 16:41, Cyrill Gorcunov wrote:
> On Thu, Sep 27, 2012 at 03:59:49PM +0800, Huang Qiang wrote:
>> HI:
>> I use a simple code to test CRIU, when it runs, the ids seem like this:
>>
>> UID        PID  PPID  PGID   SID  C STIME TTY          TIME   CMD
>> root     11988  9904 11988 11988  0 10:37 ?        00:00:00     sshd: root at pts/3
>> root     11996 11988 11996 11996  0 10:37 pts/3    00:00:00       -bash
>> root     12056 11996 12056 11996  0 10:38 pts/3    00:00:00         ./multitask_simple
>> root     12057 12056 12056 11996  0 10:38 pts/3    00:00:00           ./multitask_simple
>>
>> then I run:
>> # ./crtools dump -D /home/hq/image -t 12056
>> it is successful.
>>
>> then restore it:
>> # ./crtools restore -D /home/hq/image -t 12056
>> I got error:
>>  12057: Error (cr-restore.c:677): Requested sid 11996 doesn't match inherited 11952
>>  12056: Error (cr-restore.c:633): 12057 exited, status=1
>> Error (cr-restore.c:911): Someone can't be restored
>>
>> I read the pstree C/R code, and found that it didn't handle the situation that
>> the root task is not the session leader. But if there is only one task in the tree,
>> C/R can successful, otherwise, will face the error.
> 
> As far as I know it's expected behaviour when subtree is dumped
> (see commit 1264a7a9c6d42d3bdf383082c141c08ccf5744ac).
> 

I see, thanks.

>> Is this a bug? Or is CRIU has a limitation right now for the root task?
>> And what's your plan for this situation?
>> I think we may also need a helper for root task, of course have other things to consider.
> 
> I can't tell for all team but as for me -- when subtree is dumped there
> are a number of limitation applies and this is not a scenario which is
> encouraged. So I would say we prefer when the complete tree is dumped,
> still subtree dumping is allowed but with a number of limitations.
>

I agree with you that we should encourage to dump a complete tree. But as you said,
subtree dumping is still allowed, so the problem is depend on what's the limitations.

I think some missing is acceptable for subtree dumping, something like, before dump,
process are in foreground process group, but they will be in background process group
after restore.

Whatever the missing is, that simple and common test case like I used should not return
error, right?
What do you think Cyrill?

>> BTW, the born_sid mechanism seems didn't do any really work for rebuild the pstree,
>> but for the check. We may neither support the tree like this:
>>         pid = 5
>>         sid = 5
>>            /
>>           /
>>       pid = 7
>>       sid = 6
>>          /
>>         /
>>     pid = 9
>>     sid = 8
>>
>> Right?
>>
>> Since I didn't find any scheme for the the problems I mentioned above in the TODO
>> list, if you guys have any plan or thoughts, could you share them here?
>> And maybe I can help to do this work.
> 
> Lets wait for Pavel and Andrew answers.
> 
> 




More information about the CRIU mailing list