[Bug 260126] syslog(3) spins the CPU with 4180 byte messages
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 260126] syslog(3) spins the CPU with 4180 byte messages"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Nov 2021 00:13:23 UTC
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.