From: Tim W. <tim...@gm...> - 2005-01-20 13:04:18
|
FYI: I tried to register my own atexit function in perfparsed, that calls storage_atexit & close_all_log_sources. Unfortunately, this function gets called serveral times (each time a forked subprocess exits), and hence it does not do what you'd want. I'm not experienced enough in this matter to figure out how to get the exit handler to run only when the main process exits. If you have an idea how to do this, let me know, and I'll try it to see if it fixes this problem. Tim On Thu, 20 Jan 2005 11:36:16 +0100 (CET), Yves <yme...@pe...> wrote: > > In an attempt to figure out why the 'kill' does not induce the same > > effect on Nagios, I concluded that the reason is that kill sends a > > SIGTERM to perfparsed, which is nicely handled in log_reader.c. The > > sighandler _closes all log sources_. > > A simple exit somewehere in the application does not, and subsequent > > write attempts to the pipe are hanging (blocked). > > > > Question 1: is my conclusion correct? > > I am not sure, but I would say yes. > > > Question 2: if so, is there any way you can catch an exit call with a > > signal handler? Or should you use something like raise(SIGxxx) instead > > of exit? > > Yes, and it is already implemented. > We use atexit() to catch the exit call. > > When you kill the application, there is a signal handling, that only wait for the end of > critical operations before the normal behaviour that is leaving graciously. > > When perfparsed exit, there are places where we cannot work with the atexit() registered > functions. So it does not exits with exit() but with _exit(). Maybe this is where to > change things ? > But I have a better idea : what about creating our own exit() function, that call the > functions we register with atexit() ? And don't use exit(), _exit() and atexit() at all > ? > This is some big development. > > Tim and Ben (and others) could you check if what I say is correct ? How much work it > represents ? If this is not too hard, maybe Bruno and Remi can do it ? > (they have not been introduced yet, but I'm waiting that they manage to install nagios > and perfparse : they began 2 days ago). > > > (Q3: has anyone else experienced this problem?) > > Maybe you should ask nagios mailing-list about this, to know if somebody had this > problem and how they solved it ? However, the bug is in perfparse, not in nagios, and it > has to be fixed in perfparse. > > Yves > -- > - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - > - GPG key - http://ymettier.free.fr/gpg.txt - > - Maitretarot - http://www.nongnu.org/maitretarot/ - > - Perfparse - http://perfparse.sf.net/ - > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Perfparse-devel mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perfparse-devel > |