From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1028 Path: news.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: timeout chpst -L Date: Tue, 14 Feb 2006 08:45:09 +0000 Message-ID: <20060214084509.24951.qmail@125e08fe97c020.315fe32.mid.smarden.org> References: <20060213163054.GC2511@home.power> <20060213201807.GF6585@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="mYCpIKhGyMATD0i+" X-Trace: sea.gmane.org 1139906698 929 80.91.229.2 (14 Feb 2006 08:44:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2006 08:44:58 +0000 (UTC) Original-X-From: supervision-return-1264-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Feb 14 09:44:56 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1F8vnn-0002sq-Jz for gcsg-supervision@gmane.org; Tue, 14 Feb 2006 09:44:52 +0100 Original-Received: (qmail 13247 invoked by uid 76); 14 Feb 2006 08:45:11 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 13242 invoked from network); 14 Feb 2006 08:45:11 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <20060213201807.GF6585@home.power> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1028 Archived-At: --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 13, 2006 at 10:18:07PM +0200, Alex Efros wrote: > On Mon, Feb 13, 2006 at 06:30:54PM +0200, Alex Efros wrote: > > Is there exists some standard utility to run other process with timeout? > > ulimit isn't suitable because it can only limit used CPU time, while I'm > > speaking about real time. > > I've just discovered `tryto`. Sadly, but looks like there some race > condition bug in it when tryto used to run some process which exit > very quickly. I've tried to run `tryto chpst -l`, noticed strange > results and moved to more simple examples like `tryto true` (see > details below). > powerman@home ~/tmp $ for i in $(seq 1 10); do echo "i=$i"; tryto -v -t 2 bash -c 'true'; done > i=1 > tryto: warning: child "bash" timed out. sending TERM... > tryto: warning: child "bash" not terminated. sending KILL... > tryto: fatal: child timed out, giving up. Yes, it's a race, the patch below should help. Thanks, Gerrit. --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Index: src/tryto.c =================================================================== RCS file: /var/lib/cvs/socklog/src/tryto.c,v retrieving revision 1.8 diff -u -r1.8 tryto.c --- src/tryto.c 6 Feb 2005 11:36:50 -0000 1.8 +++ src/tryto.c 13 Feb 2006 20:42:13 -0000 @@ -104,6 +104,7 @@ taia_now(&now); taia_uint(&deadline, timeout); taia_add(&deadline, &now, &deadline); + timeout =0; for (;;) { int iopausefds; --mYCpIKhGyMATD0i+--