supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: timeout chpst -L
Date: Tue, 14 Feb 2006 12:39:54 +0000	[thread overview]
Message-ID: <20060214123954.17614.qmail@878d42c770614c.315fe32.mid.smarden.org> (raw)
In-Reply-To: <20060214115405.GQ6585@home.power>

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

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.

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1254 bytes --]

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);

  reply	other threads:[~2006-02-14 12:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-13 16:30 Alex Efros
2006-02-13 20:18 ` Alex Efros
2006-02-14  8:45   ` Gerrit Pape
2006-02-14 10:23     ` Alex Efros
2006-02-14 10:36       ` Gerrit Pape
2006-02-14 11:01         ` Alex Efros
2006-02-14 11:21           ` Gerrit Pape
2006-02-14 11:30             ` Alex Efros
2006-02-14 11:36               ` Gerrit Pape
2006-02-14 11:54                 ` Alex Efros
2006-02-14 12:39                   ` Gerrit Pape [this message]
2006-02-14 12:53                     ` Alex Efros

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=20060214123954.17614.qmail@878d42c770614c.315fe32.mid.smarden.org \
    --to=pape@smarden.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).