On Wed, Aug 5, 2009 at 11:57 AM, Michael Goldish<[email protected]> wrote:
> kvm_spawn.is_alive() incorrectly assumes that /proc/$PID/cmdline immediately
> reflects the new command line of the forked process.  This makes it report
> false negatives occasionally.  To prevent that, perform the command line check
> only if the process is more than 10 seconds old, or if the process has been
> pickled and unpickled.  In both cases, there is more than enough time for
> /proc/$PID/cmdline to get updated.

Ok, bugfix applied!

> Signed-off-by: Michael Goldish <[email protected]>
> ---
>  client/tests/kvm/kvm_subprocess.py |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_subprocess.py 
> b/client/tests/kvm/kvm_subprocess.py
> index df1d562..457c12e 100644
> --- a/client/tests/kvm/kvm_subprocess.py
> +++ b/client/tests/kvm/kvm_subprocess.py
> @@ -214,6 +214,8 @@ class kvm_spawn:
>             # Wait for the server to complete its initialization
>             while not "Server %s ready" % self.id in sub.stdout.readline():
>                 pass
> +            # Remember the start time for is_alive()
> +            self.start_time = time.time()
>
>         # Open the reading pipes
>         self.reader_fds = {}
> @@ -379,6 +381,10 @@ class kvm_spawn:
>         except:
>             # If we couldn't find the file for some reason, skip the check
>             return True
> +        # If this process is new (less than 10 secs old) skip the check
> +        if hasattr(self, "start_time") and time.time() < self.start_time + 
> 10:
> +            return True
> +        # Perform the check
>         if self.id in cmdline:
>             return True
>         return False
> --
> 1.5.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Lucas Meneghel
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to