Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2021 00:13:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 260126] syslog(3) spins the CPU with 4180 byte messages
Message-ID:  <bug-260126-227-cEhA4wKbHV@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-260126-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260126

Alan Somers <asomers@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open

--- Comment #1 from Alan Somers <asomers@FreeBSD.org> ---
So the problem seems to be that:

* The default receive buffer size for a unix domain socket is 4 kB
* connectlog() sets SO_SNDBUF to 8 kB
* BUT, unix domain datagram sockets don't really have a send buffer.  Unlike
inet sockets, they stay on one host, so everything goes straight to the receive
buffer.  See uipc_send(); it writes into so2->so_rcv, not so->so_snd.
* syslogd sets SO_RCVBUF to 80 kB, which is why nobody noticed the problem
there.
* rsyslogd uses the default SO_RCVBUF of 4 kB
* syslog(3) chops up messages that are longer than MAXLINE.  But now MAXLINE is
8 kB, and the SO_RCVBUF is only 4 kB.  So the chopped up messages are too large
for the buffer.
* syslog(3) loops while (errno == ENOBUFS), which is not appropriate if the
message is too big to ever fit.  BUT, it fails fast if the socket is
privileged.  Many daemons are, so their operators won't notice this bug, but my
daemon is not.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-260126-227-cEhA4wKbHV>