posible bug in daemontools

Jan Mojžíš <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
Hello,
I found posible bug in daemontools supervise.

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.

In readproctitle is only message:
supervise: warning: unable to fork for dnscache, sleeping 60 seconds: out of memory

Did anyone see same problem or am I first?

Thanks
J. Mojzis

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

diff -Nur admin.orig/daemontools-0.76/src/supervise.c admin/daemontools-0.76/src/supervise.c
--- admin.orig/daemontools-0.76/src/supervise.c 2010-02-19 11:08:15.000000000 +0100
+++ admin/daemontools-0.76/src/supervise.c      2010-02-19 12:53:16.000000000 +0100
@@ -86,6 +86,8 @@

 const char *run[2] = { "./run", 0 };

+int flagfailed = 0;
+
 void trystart(void)
 {
   int f;
@@ -94,6 +96,7 @@
     case -1:
       strerr_warn4(WARNING,"unable to fork for ",dir,", sleeping 60 seconds: ",&strerr_sys);
       deepsleep(60);
+      flagfailed = 1;
       trigger();
       return;
     case 0:
@@ -153,6 +156,11 @@
       }
     }

+    if (flagfailed && flagwant && flagwantup){
+      flagfailed = 0;
+      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.