[Dnsmasq-discuss] log_stderr + SIGPIPE

Simon Kelley simon at thekelleys.org.uk
Wed Sep 29 16:15:15 BST 2010

clemens fischer wrote:
> 'uname -rims' -> Linux i686 AuthenticAMD
> Dnsmasq version 2.56test10
>>From time to time a friend of mine complains about WLAN stopping to
> work.  The WLAN is the cheapest setup possible:  ad-hoc with dnsmasq
> giving out IPs and DNS service.  I'm using a service supervisor for
> dnsmasq, which logs to stderr and that output is sent to a file by
> a special logging daemon (not syslog).
> I was once able to find a concrete problem:  dnsmasq couldn't send
> further log entries, because the logger had a temporary overrun and
> wasn't able to get rid of the log fast enough.
> Now in the source I see these lines:
> src/log.c, lines 194ff:
>       /* Once a stream socket hits EPIPE, we have to close and re-open
>          (we ignore SIGPIPE) */
>       if (errno == EPIPE) ...
> Could it be that the case of logging to stderr connected to a pipe
> suffers from the same condition and hangs up dnsmasq which ignores
> Unfortunately this problem is rare and not easily reproducable, but I'd
> help testing a possible fix anyway, even if it takes time.

I'm pretty sure that writes will simply block if the reader at the other
end of the pipe is too slow. EPIPE occurs for the writer when the reader
actually closes the file descriptor.

Of course if you were using a syslogd you could turn on asychronous
logging in dnsmasq and this problem would disappear....



More information about the Dnsmasq-discuss mailing list