Re: posible bug in daemontools

Matthew Dempsky <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
On Sun, Mar 14, 2010 at 1:17 AM, Jan Mojžíš <[email protected]> wrote:
> When is system out of memory, and some service (dnscache) is killed by OOM or die and
> supervise than fails to fork new process, supervise never start dnscache.

Indeed, supervise.c doesn't appear to correctly handle restarting the
monitored process if fork(2) fails.

> Did anyone see same problem or am I first?

I haven't heard of this problem before, and Google doesn't turn up
anything interesting.

> This patch  FIX my problem, but I'm not sure if it is correct way to solve this problem.

I think your patch is fine.  I would probably do this instead, though:

--- supervise.c~	2001-07-12 09:49:49.000000000 -0700
+++ supervise.c	2010-03-14 03:29:08.000000000 -0700
@@ -148,11 +148,12 @@
 	pidchange();
 	announce();
 	if (flagexit) return;
-	if (flagwant && flagwantup) trystart();
 	break;
       }
     }

+    if (flagwant && flagwantup && !pid) trystart();
+
     if (read(fdcontrol,&ch,1) == 1)
       switch(ch) {
 	case 'd':
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.