From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1039 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 12:39:54 +0000 Message-ID: <20060214123954.17614.qmail@878d42c770614c.315fe32.mid.smarden.org> References: <20060213163054.GC2511@home.power> <20060213201807.GF6585@home.power> <20060214084509.24951.qmail@125e08fe97c020.315fe32.mid.smarden.org> <20060214102323.GL6585@home.power> <20060214103625.4267.qmail@65cebaedea5163.315fe32.mid.smarden.org> <20060214110159.GM6585@home.power> <20060214112106.9099.qmail@7d7a65a7e7aa60.315fe32.mid.smarden.org> <20060214113009.GO6585@home.power> <20060214113623.10627.qmail@a0b001f5c3a22b.315fe32.mid.smarden.org> <20060214115405.GQ6585@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="z4+8/lEcDcG5Ke9S" X-Trace: sea.gmane.org 1139920781 19300 80.91.229.2 (14 Feb 2006 12:39:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2006 12:39:41 +0000 (UTC) Original-X-From: supervision-return-1275-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Feb 14 13:39:39 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 1F8zSw-0001p1-7x for gcsg-supervision@gmane.org; Tue, 14 Feb 2006 13:39:35 +0100 Original-Received: (qmail 17518 invoked by uid 76); 14 Feb 2006 12:39:55 -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 17513 invoked from network); 14 Feb 2006 12:39:55 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <20060214115405.GQ6585@home.power> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1039 Archived-At: --z4+8/lEcDcG5Ke9S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 14, 2006 at 01:54:05PM +0200, Alex Efros wrote: > On Tue, Feb 14, 2006 at 11:36:23AM +0000, Gerrit Pape wrote: > > It's a bug, at the same place in the source as the other two problems > > you discovered. After looking at the recent patch I sent, do you have > > an idea how to fix it ;-)? > > Not fair! I don't know C, I'm a Perl programmer... but I'm also a > sysadmin, so I've spend a lot of time patching other's C, C++, etc. > programs without knowing these languages. Fair enough ;-). I suggest the patch below against tryto from socklog 2.0.2. Can you please try it out? Thanks for your bug reports, Gerrit. --z4+8/lEcDcG5Ke9S 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 14 Feb 2006 12:34:04 -0000 @@ -104,6 +104,7 @@ taia_now(&now); taia_uint(&deadline, timeout); taia_add(&deadline, &now, &deadline); + timeout =0; for (;;) { int iopausefds; @@ -163,16 +164,16 @@ int i; char *s; - if (wait_nohang(&rc) == pid) break; - taia_now(&now); - if ((timeout =taia_less(&deadline, &now))) break; - sig_unblock(sig_child); iopause(x, iopausefds, &deadline, &now); sig_block(sig_child); while (read(selfpipe[0], &ch, 1) == 1) {} + taia_now(&now); + if ((timeout =taia_less(&deadline, &now))) break; + if (wait_nohang(&rc) == pid) break; + r = buffer_feed(&buffer_x); if (r < 0) { if ((errno == error_intr) || (errno == error_again)) continue; @@ -201,6 +202,7 @@ close(cpipe[1]); if (timeout) { + if (wait_nohang(&rc) == pid) break; /* child not finished */ strerr_warn4(WARNING, "child \"", *argv, "\" timed out. sending TERM...", 0); --z4+8/lEcDcG5Ke9S--