[DTrace-devel] [PATCH 10/13] Try an orderly shutdown if a test times out

Kris Van Hees kris.van.hees at oracle.com
Mon Jul 6 22:24:34 PDT 2020


Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

On Wed, Jul 01, 2020 at 10:41:15PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> The test suite has a time-out mechanism.  Currently, it sends a
> KILL signal, which does not allow DTrace to clean up after itself.
> 
> Use TERM for the time-out signal, since it (and INT) are captured
> by DTrace and allow an orderly shutdown.  Specify as well that a
> KILL signal should be sent if the command is still running a few
> seconds after the initial signal.
> 
> The timeout return code is different depending on whether the first
> or the KILL signal terminated the job, but runtest.sh already checks
> this.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  runtest.sh | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/runtest.sh b/runtest.sh
> index 7c0957ce..ad579ef1 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -81,14 +81,18 @@ ZAPTHESE=
>  #
>  # Run command CMD with argument ARGS, with the specified timeout.
>  # Return the exitcode of the command, or $TIMEOUTRET if a timeout occurred.
> +# Also send a KILL signal if the command is still running TIMEOUTKIL seconds
> +# after the initial signal is sent, but start with TIMEOUTSIG so that DTrace
> +# can perform an orderly shutdown, if possible.
>  
> -TIMEOUTSIG=KILL
> +TIMEOUTSIG=TERM
>  TIMEOUTRET=124
> +TIMEOUTKIL=5
>  
>  run_with_timeout()
>  {
>      log "Running timeout --signal=$TIMEOUTSIG $@ ${explicit_arg:+"$explicit_arg"}\n"
> -    timeout --signal=$TIMEOUTSIG $@ ${explicit_arg:+"$explicit_arg"}
> +    timeout --signal=$TIMEOUTSIG --kill-after=$TIMEOUTKIL $@ ${explicit_arg:+"$explicit_arg"}
>      local status=$?
>  
>      # short wait to allow any coredump to trickle out to disk.
> -- 
> 2.18.2
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list