[Top][All Lists]

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

Re: PID-reuse races fix, introduced GCC validation brakage

From: Pedro Alves
Subject: Re: PID-reuse races fix, introduced GCC validation brakage
Date: Thu, 31 Mar 2016 18:35:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 03/31/2016 04:25 PM, Yvan Roux wrote:
> Hi Pedro,
> On 31 March 2016 at 16:20, Pedro Alves <address@hidden> wrote:

> The regression is due to this part:
> +    # Reap it.
> +    set res [catch "wait -i $program_id" wres]
> +    if {$exec_pid != -1} {
> +       # We reaped the process, so cancel the pending force-kills, as
> +       # otherwise if the PID is reused for some other unrelated
> +       # process, we'd kill the wrong process.
> +       exec sh -c "exec > /dev/null 2>&1 && kill -9 $exec_pid"
> +    }
> In our case the "wait -i" command ends without any effect on the
> running processes 

"wait" just reaps an already zombie process.  So if that returns,
$program_id either already exited and is zombie, or wait
returned an error.

> and then it kills the command which was about to
> kill them, and the validation is stuck.

So before my patch, the "wait -i" would also return immediately,
but it just happened that the "kill -15 $pgid" etc. commands kept
running in the background and ended up killing the processes
after the 5 / 10 seconds sleeps.  Correct?

How come the "wait -i" returns before _any_ process is
dead/zombie, as you say?  Did wait return an error?
I suspect that's something to do with taking the open path
instead of spawn, due to redirection.

And I wonder why the "kill -2 $pgid | kill -2 $pid" command didn't
cause "cat" to exit?

Pedro Alves

reply via email to

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