Re: [Fuego] [fuego-core 2/7] ftc: fix test process is not killed when fuego test times out

<[email protected]> Thu, 22 Jul 2021 18:34:46 +0000
Newsgroups dev.linux.lists.fuego
Message-ID <BYAPR13MB250361EA5AB6F581C7A6C137FDE49@BYAPR13MB2503.namprd13.prod.outlook.com>
OK - I have a question on this one.

> -----Original Message-----
> From: [email protected] <[email protected]>
> 
> From: nguyen thi huong <[email protected]>
> 
> - Currently, fuego kill main process and does not kill test process when test times out
>   In that case, test process still runs but fuego test result is not available
> - Revise implementation to kill all test processes and printout the result
> 
> Signed-off-by: nguyen thi huong <[email protected]>
> Signed-off-by: venkata pyla <[email protected]>
> ---
>  scripts/ftc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/ftc b/scripts/ftc
> index 2a6a640..5c300d0 100755
> --- a/scripts/ftc
> +++ b/scripts/ftc
> @@ -3914,7 +3914,7 @@ def ftc_exec_command(command, timeout):
> 
>      dprint("ftc_exec_command: command=%s" % command)
> 
> -    p = subprocess.Popen(command.split(), stdout=log, stderr=log)
> +    p = subprocess.Popen(command.split(), stdout=log, stderr=log, preexec_fn=os.setpgrp)
> 
>      # specify timeout for command operation
>      signal.signal(signal.SIGALRM, alarm_handler)
> @@ -3960,7 +3960,8 @@ def ftc_exec_command(command, timeout):
>          #    p.kill()
> 
>          # abort with prejudice...
> -        p.kill()
> +        pgrp = os.getpgid(p.pid)
> +        os.killpg(pgrp, signal.SIGALRM)

Why are you sending a SIGALARM instead of a SIGKILL?
This is a weaker signal, that can be ignored or masked.

>          timed_out = True
> 
>      finally:
> --
> 2.20.1
> 

I've applied this patch, but I'd like to know if you have some reason for weakening the
signal sent to kill the process.

Thanks.
 -- Tim