FW: failed to daemon()

Garrett, Philip (MAN-Corporate) Philip.Garrett at manheim.com
Tue Dec 20 16:34:31 UTC 2005


Apologies if this gets sent twice -- I had to resubscribe... 

-----Original Message-----
From: Garrett, Philip (MAN-Corporate) 
Sent: Tuesday, December 20, 2005 11:32 AM
To: memcached at lists.danga.com
Subject: RE: failed to daemon()


> -----Original Message-----
> From: memcached-bounces at lists.danga.com 
> [mailto:memcached-bounces at lists.danga.com] On Behalf Of Greg Whalin
> Sent: Tuesday, December 20, 2005 11:22 AM
> To: Brian Moon
> Cc: memcached at lists.danga.com; lisa at gentoo.org
> Subject: Re: failed to daemon()
> 
> Lisa Seelye wrote:
> > On Tue, 2005-12-20 at 09:55 -0600, Brian Moon wrote:
> > 
> >>We have memcached 1.1.12 deployed on 5 Gentoo machines already.  We 
> >>have two fresh Gentoo 2005.1 installed servers with memcached 1.1.12
emerged.
> >>  We are getting the error: "failed to daemon() in order to
daemonize" 
> >>when using the -d option.  We have it working by using 
> >>start-stop-daemon with the background option, but would rather not 
> >>have these two machines running different than the other Gentoo
boxes.
> >>I see the code that is throwing the error, but I have no idea what
could be causing it.
> >>
> >>Anyone have any ideas?
> > 
> > What code is it failing on? Can you send a backtrace?
> 
> I would imagine that error is from the start-stop-deamon command in 
> Gentoo? Are you seeing any errors in your logs (/var/log/??) from the 
> memcached startup?
> 

That message is generated by memcached, not by scripts.  If you apply
this patch to your memcached source and rebuild, I think you'll get a
slightly more useful error message:

diff -c memcached-1.1.12.orig/memcached.c memcached-1.1.12/memcached.c
*** memcached-1.1.12.orig/memcached.c   2005-04-04 20:10:26.000000000
-0400
--- memcached-1.1.12/memcached.c        2005-12-20 11:27:12.267933000
-0500
***************
*** 1489,1495 ****
          int res;
          res = daemon(maxcore, settings.verbose);
          if (res == -1) {
!             fprintf(stderr, "failed to daemon() in order to
daemonize\n");
              return 1;
          }
      }
--- 1489,1495 ----
          int res;
          res = daemon(maxcore, settings.verbose);
          if (res == -1) {
!             perror("failed to daemon() in order to daemonize");
              return 1;
          }
      }



More information about the memcached mailing list