[Kamailio-Users] new feature: non-blocking logging

Henning Westerholt henning.westerholt at 1und1.de
Wed Oct 15 19:18:11 CEST 2008


Hi all,

i just commited support for non-blocking logging to the trunk. This was 
implemented using the syslog-async functionality from the dnsmasq server [1] 
from Simon Kelley. 

The standard Unix syslog() library routine can block waiting for the syslog 
daemon. On some systems, using a datagram socket for /dev/log avoids endless 
waits, but on Linux, even this does not work. Try typing

killall -SIGSTOP $pid_of_syslog

into a root terminal on a non-critical machine. Then generate traffic to get 
some logs, eventually, the server will stop. This blocking of the syslog 
daemon can happens because of bugs, or if the daemon waits for external 
events, like DNS lookups.

Instead of blocking, log-lines are buffered in memory. The buffer size is 
limited and if the buffer overflows log lines are lost. When lines are lost 
this fact is logged with a message.

This functionality can be enabled with setting the define SYSLOG_ASYNC in the 
Makefile.defs file. The default is the normal log functionality from the 
system library, nothing changed if the define is not set.

I tested this with our internal tests suite, and also the tests in the trunk. 
You can get the code from the svn repository, we also provide debian packages 
for several debian releases on devel.kamailio.org.

Cheers,

Henning


[1] http://www.thekelleys.org.uk/dnsmasq/doc.html


-- 
Henning Westerholt - Development Consumer Products / DSL Core
1&1 Internet AG, Ernst-Frey-Str. 9, 76135 Karlsruhe, Germany




More information about the Users mailing list