[syslog-ng]cannot get sec.pl to exit after syslog-ng does

Balazs Scheidler syslog-ng@lists.balabit.hu
Tue, 04 May 2004 16:29:34 +0200


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