[CRIU] Another question / roadblock

Eliot Moss moss at cs.umass.edu
Tue Oct 15 15:01:10 MSK 2019


On 10/15/2019 2:10 AM, Andrei Vagin wrote:
> On Mon, Oct 14, 2019 at 09:49:31PM -0400, Eliot Moss wrote:
>>
>> Now that I have figured out how to adjust file lengths before invoking
>> restore, I have another "interesting" issue.
>>
>> My jobs have one part that is some layers of shell script that bottoms out
>> with an invocation of valgrind, which produces output to a named pipe (fifo).
>> Then they have another part that reads from the named pipe, sends the output to
>> about 8 analysis programs, compresses their output, etc.
>>
>> This second part is created, and then disowned with the shell disown command.
>>
>> Applying dump to the first part does not capture the second part.  So my
>> question is, how do I capture both parts?
>>
>> (Explanation: I did things this way so that the analysis jobs don't die
>> when the valgrind jobs finishes, but finish reading from the fifo and
>> processing the buffered data.)
> 
> I think you need to run your processes in a new pid namespace.
> http://man7.org/linux/man-pages/man7/pid_namespaces.7.html
> 
> The easiest way to run a process in a new pid namespace is to use
> the unshare tool:
> 
> sudo unshare -pf sh -c 'echo "My pid is $$"'
> 
> or the same without sudo:
> 
> unshare -Urfp sh -c 'echo "My pid is $$"'

Aha, that seems very plausible.  If I understand correctly, I would do this
and it would cause those disowned processes to be children of the lead process
under unshare, thus capturing all parts of my job in a single tree.

I'll see if I can try that soon ... I have to consider the best place to
insert the unshare, though I don't think that is too difficult.

Thank you for helping me figure this out!    Eliot


More information about the CRIU mailing list