RE: [syslog-ng]cannot get sec.pl to exit after syslog-ng does
I am still unable to explain this. After Bazsi's explanation on the correlation between syslog-ng, C, scheme and lsh (it's not cryptic - my scheme is just a little rusty), I was able to walk through the source and see that the pid and kill handler are registered correctly in the resource list for the syslog-ng configuration. This means all children should get a SIGTERM when syslog-ng gets a SIGTERM - just before it exits the main loop. However, I am not observing this behavior. Also, I don't see CONFIG_DESTROY being called on the old configuration when the new configuration is reloaded, but I haven't walked through all that source. I'm still getting familiar with all of this so excuse me if I don't have everything straight. FYI, I'm using the libol 0.3.13 package from sunfreeware.com (SUNWlibol) and a custom complied syslog-ng 1.6.2 under Solaris 7. Any additional insights / explanations would be helpful. Thanks. Tony -- "Computer science is as much about computers as astronomy is about telescopes" -- Edsger Dijkstra --------------------------------------------------------- Anthony Tonns, UNIX Administrator - atonns@mail.ivillage.com
-----Original Message----- From: Nate Campi [mailto:nate@campin.net] Sent: Wednesday, April 28, 2004 10:06 PM To: syslog-ng@lists.balabit.hu Subject: Re: [syslog-ng]cannot get sec.pl to exit after syslog-ng does
On Wed, Apr 28, 2004 at 02:58:47PM -0700, Nate Campi wrote:
Ok. I don't know why mine is a child of syslog-ng, and it properly terminates when syslog-ng does. We must not be on the same
version or
something. 1.5.26 here.
I just fired up sec on a solaris 9 box:
9130 /usr/local/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf 16508 /bin/sh -c /usr/local/sbin/sec.pl -input="-" -conf=/usr/local/etc/sec.conf 16509 /usr/bin/perl -w /usr/local/sbin/sec.pl -input=- -conf=/usr/local/etc/sec.conf
It isn't perl either, since starting a program with no arguments or redirection also gets started by a shell on solaris:
9130 /usr/local/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf 16508 /bin/sh -c /usr/local/sbin/sec.pl -input="-" -conf=/usr/local/etc/sec.conf 16509 /usr/bin/perl -w /usr/local/sbin/sec.pl -input=- -conf=/usr/local/etc/sec.conf 16616 /bin/sh -c /usr/local/bin/splogger 16617 /usr/local/bin/splogger 16618 /bin/sh -c /usr/local/sbin/sec.pl -input="-" -conf=/usr/local/etc/sec.conf 16619 /usr/bin/perl -w /usr/local/sbin/sec.pl -input=- -conf=/usr/local/etc/sec.conf
Notice the two SEC's, I hupped syslog-ng when adding this:
#--------------------------- destination d_splogger { program("/usr/local/bin/splogger"); };
# send all logs to splogger log { source(src); filter(f_not_brightmail); destination(d_splogger); }; #---------------------------
So it's certainly different behavior on Linux and Solaris in respect to starting child processes (syslog-ng 1.5.24 on Solaris).
Bazsi can you explain what's going on here? iVillage Inc., 500 Seventh Avenue, New York, NY 10018 - iVillage Inc. is a leading women's media company that includes iVillage.com, Women.com, gURL.com, Astrology.com, Promotions.com, iVillage Parenting Network, The Newborn Channel, Lamaze Publishing, Business Women's Network, Diversity Best Practices, Best Practices in Corporate Communications, and iVillage Consulting. The information contained in this communication may be confidential, is intended only for the use of the recipient named above, and may be construed under applicable law to be a commercial email. If you have received this communication in error, please delete this message from your computer system. If you are the recipient named above and do not wish to receive any future commercial emails, please reply to the sender with a message stating such preference.
2004-05-03, h keltezéssel 19:21-kor atonns@mail.ivillage.com ezt írta:
I am still unable to explain this.
After Bazsi's explanation on the correlation between syslog-ng, C, scheme and lsh (it's not cryptic - my scheme is just a little rusty), I was able to walk through the source and see that the pid and kill handler are registered correctly in the resource list for the syslog-ng configuration. This means all children should get a SIGTERM when syslog-ng gets a SIGTERM - just before it exits the main loop. However, I am not observing this behavior.
I've tried to reproduce the problem you are describing, but without success. I attached with strace to syslog-ng and its child process (this time it was /bin/cat), and here are the results: syslog-ng: poll([{fd=6, events=0}, {fd=4, events=POLLIN}, {fd=3, events=POLLIN}], 3, 100) = 0 poll([{fd=6, events=0}, {fd=4, events=POLLIN}, {fd=3, events=POLLIN}], 3, 1000) = 0 write(2, "Marking fd 3 for closing.\n", 26Marking fd 3 for closing. ) = 26 write(2, "Marking fd 4 for closing.\n", 26Marking fd 4 for closing. ) = 26 write(2, "Marking fd 6 for closing.\n", 26Marking fd 6 for closing. ) = 26 kill(9032, SIGTERM) = 0 cat: $ strace -p 9032 Process 9032 attached - interrupt to quit read(0, 0x804d848, 4096) = ? ERESTARTSYS (To be restarted) --- SIGTERM (Terminated) @ 0 (0) --- Process 9032 detached So cat receives the TERM signal, maybe it is blocked for you in some ways? Another thing that should terminate your process is that syslog-ng closes the write side of its pipe e.g. your perl script should have received an EOF on its standard input, even if it does not receive the term signal.
Also, I don't see CONFIG_DESTROY being called on the old configuration when the new configuration is reloaded, but I haven't walked through all that source. I'm still getting familiar with all of this so excuse me if I don't have everything straight.
this is in main.c around line 77: self->backend->persistent = make_persistent_config(); CONFIG_DESTROY(self->backend->configuration, self->backend->persistent); self->state++; self->backend->oldconfig = self->backend->configuration; self->backend->configuration = self->backend->newconfig; io_callout(&self->backend->super, 0, c);
FYI, I'm using the libol 0.3.13 package from sunfreeware.com (SUNWlibol) and a custom complied syslog-ng 1.6.2 under Solaris 7.
-- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
atonns@mail.ivillage.com
-
Balazs Scheidler