All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [OSSTEST PATCH] TestSupport: use timeout(1)
Date: Mon, 8 Dec 2014 14:16:37 +0000	[thread overview]
Message-ID: <1418048197.2827.11.camel@citrix.com> (raw)
In-Reply-To: <1418047685-27801-1-git-send-email-ian.jackson@eu.citrix.com>

On Mon, 2014-12-08 at 14:08 +0000, Ian Jackson wrote:
> If a command we run times out, the machinery in tcmdex() will arrange
> for the ts-* script to spot the timeout, and stop waiting for it.
> 
> However it is also necessary for the command we ran to die.  It has a
> copy of the owner daemon fd, so if it doesn't, our resources won't get
> freed.  In sufficiently exciting bugs, our allocation might continue
> indefinitely, while a subprocess of ours hangs on after we are long
> gone.
> 
> timeout(1) does not print a message when the process times out (!)  So
> we can't do away with the logic in tcmdex().

I think you mean s/tcmdex/cmd/ in a few places here, since cmd() is
where all the existing timeout stuff is.

>   We set the timeout(1)
> timeout to 30s more than our own timeout, so that tcmdex() will time
> out first and print a message.
> 
> We could use alarm(1) as we do in Osstest/Serial/sympathy.pm but that
> program isn't packaged and its unsophisticated approach is not really
> appropriate for arbitrary nonconsenting programs.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Apart from that niggle:
Acked-by: Ian Campbell <ian.campbell@citrix.com>


> ---
>  Osstest/TestSupport.pm |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> index a3b6936..ca680c0 100644
> --- a/Osstest/TestSupport.pm
> +++ b/Osstest/TestSupport.pm
> @@ -388,7 +388,10 @@ sub sshopts () {
>  sub tcmdex {
>      my ($timeout,$stdout,$cmd,$optsref,@args) = @_;
>      logm("executing $cmd ... @args");
> -    my $r= cmd($timeout,$stdout, $cmd,@$optsref,@args);
> +    # We use timeout(1) as a backstop, in case $cmd doesn't die.  We
> +    # need $cmd to die because we won't release the resources we own
> +    # until all of our children are dead.
> +    my $r= cmd($timeout,$stdout, 'timeout',$timeout+30, $cmd,@$optsref,@args);
>      $r and die "status $r";
>  }
>  

      reply	other threads:[~2014-12-08 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08 14:08 [OSSTEST PATCH] TestSupport: use timeout(1) Ian Jackson
2014-12-08 14:16 ` Ian Campbell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418048197.2827.11.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.