Re: Penlogd not responding to TERM and HUP signals

From: Ulric Eriksson (ulric@siag.nu)
Date: Sat Oct 11 2003 - 14:42:59 CEST


On Fri, 10 Oct 2003, Diego Francisco de Gastal Morales wrote:

> The man page for penlogd says it will flush to the logfile if I kill
> -HUP it (or -TERM and then exit). But that's not happening for me. It
> does not write the log, nor exit.
>
> It does respond to kill -9, but then (as expected) it does not write
> the logfile.
> It's a Freebsd 5.1 machine, pen 0.11.0. But the same occurs on my linux
> machine.
>
> Is it a known bug?

It's not really a bug, it just doesn't work exactly as advertised. ;-)

Since it's not safe for the signal handlers to do anything useful, they
just set flags for things that will be done in the next pass through the
main loop. But since penlogd sits blocking in recvfrom, that won't happen
until it receives its next udp message. That doesn't matter for a busy
site because the call won't block for long, but it's probably annoying if
you just want to test flushing the logfile.

One might wonder why recvfrom doesn't return when it is interrupted by the
signal. Well, that's just how it is.

I have uploaded a new penlogd.c to the usual place. It uses posix style
signals, which allows this kind of legacy silliness to be disabled. If you
try it out on your bsd system and it seems to work, we can just switch to
that instead.

Ulric



This archive was generated by hypermail 2.1.2 : Sat Oct 11 2003 - 14:43:38 CEST