parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternate termination sequence option --term-seq


From: Ole Tange
Subject: Re: Alternate termination sequence option --term-seq
Date: Wed, 29 Apr 2015 08:17:34 +0200

On Tue, Apr 28, 2015 at 8:31 PM, Martin d'Anjou
<martin.danjou14@gmail.com> wrote:
> On 15-04-27 05:06 PM, Ole Tange wrote:
>>
>> This you have to elaborate. Explain how this --termseq is executed
>> (with special emphasis on process groups):
>>
>> --termseq HUP,2,TERM,10,TERM,20,INT,30,KILL

Thanks for  the elaboration.

> Let's assume that the user calls GNU Parallel and wants two iterations:
> parallel [options] --termseq HUP,2,TERM,10,TERM,20,INT,30,KILL cmd ::: 1 2
:
> So as soon as the cmd processes are gone, GNU Parallel looks at the whole
> process tree, and sends the termination sequence to all of them.

I can see at least one issue with this: When does GNU Parallel map the tree?

If it does that before the first signal is sent, the risk is that the
tree changes before the second round. And if a process takes 10
seconds to shut down, it is pretty likely that it needs to run all
sorts of commands to shut down - thus changing the tree. It also has
the (albeit small) risk that a PID will be reused by an innocent
process, and that this PID will be killed in the second round. This
risk is biggest on systems that choose random PIDs (e.g. OpenBSD,
MirOS).

If the mapping is done after the last KILL, then there is no tree to map.

Maybe the best you can do is:

* Map the tree
* Do first round of killing immediate children
* Map the branches of every (grand*)children
* Do a second round of killing of these branches

This still has the risk of killing an innocent PID and its children.


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]