Gladish, Jacob wrote: > >> -----Original Message----- >> From: Daniel Pocock [mailto:dan...@pocock.com.au] >> Sent: Wednesday, December 02, 2009 6:49 AM >> To: Carlo Marcelo Arenas Belon >> Cc: ganglia-developers@lists.sourceforge.net; Ganglia >> Subject: Re: [Ganglia-developers] [Ganglia-general] Ganglia 3.1.5 beta >> ready for final testing >> >> >> >>> fork() doesn't work because the kqueue filehandle is not inherited; >>> >> using >> >>> rfork() instead doesn't either because all filehandles are closed by >>> >> doing >> >>> exit(0) in the parent and so fails in the same way that changing >>> apr_proc_detach() does when changed to use rfork() instead. >>> >>> >> I'm not a BSD expert, do you know if there is any ioctl or something >> that can be used to tell BSD to keep the file descriptors for the child >> process? >> >> >> > [Gladish, Jacob] > > There's a specific section that states that the fd returned from kqueue() is > not inherited following a fork(). There is info about using rfork(), which > means patching apr. I would avoid that. > > http://people.freebsd.org/~jmg/kqueue.historic.man.html > > The openbsb manpage has a little more info about rfork() and the flags it > uses. > > http://resin.csoft.net/cgi-bin/man.cgi?sektion=2&topic=kqueue > > In general, I think would be better to daemonize the gmond as early as > possible to avoid these types of issues. Is there any reason why the call to > daemonize_if_necessary() call cannot be moved up in main to be right before > the call to load_metric_modules()? It looks like the only real difference > would be that any errors encountered setting up the send/receive sockets > would be reported via syslog instead of stdout. > I would like gmond to return a non-zero return code if it fails to initialise, e.g. if it is unable to bind or if it is unable to resolve a hostname mentioned in gmond.conf
Otherwise, the init-script always says that it started '[OK]' even if the daemon process has died on startup. That is why this change was made. However, I see a few solutions going forward: - we can discard the patch completely - we can discard the patch, and I could write another patch that does some tests (e.g. resolving host names) before daemonizing - we can #ifdef the patch so that on BSD systems, it daemonizes earlier, and on other systems it does so later - we can modify the init script to sleep and then call `ps -C gmond' and determine if it kept running - post the problem on the apr dev list and discuss it there before making any decision ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers