[Bug 200429] sysutils/rsyslog8 endless loop when started at boot time with some rules to write on the console
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun May 24 18:11:35 UTC 2015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200429
Bug ID: 200429
Summary: sysutils/rsyslog8 endless loop when started at boot
time with some rules to write on the console
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: Individual Port(s)
Assignee: brd at FreeBSD.org
Reporter: fbsd.bugzilla at fenyo.net
Flags: maintainer-feedback?(brd at FreeBSD.org)
Assignee: brd at FreeBSD.org
Created attachment 157101
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=157101&action=edit
patch to correct the bug
Hi,
This bug report is about the four rsyslog ports: sysutils/rsyslog8,
sysutils/rsyslog7, sysutils/rsyslog8-devel, sysutils/rsyslog7-devel.
When rsyslog is started at boot time (for instance by setting
rsyslogd_enable="YES" in rc.conf(5), by adding "service rsyslogd onestart" in
rc.local(8), or by simply adding the daemon path and args in rc.local(8)), and
when rsyslog is simultaneously configured to output some streams to
/dev/console, the daemon will start correctly but, at the near end of the boot
sequence of the operating system, it will fail permanently, in an endless loop,
using 100% CPU.
Attached to this bug report, please find a patch to correct this behaviour. To
add this patch to the port, just add the file to the "files" directory. Note
that the patch is named *.c2 since another patch for the same file is currently
discussed in bug report 200270.
Here is a complete explanation of the steps that make the bug happen:
1- when init(8) launches rc(8) scripts, rsyslogd starts
2- rsyslogd reads rsyslog.conf(5) and if some stuff must be logged to the
console, because of a line like "*.err;kern.warning;auth.notice;mail.crit
/dev/console" in the configuration file, the daemon calls open(2) to get a file
descriptor to write on "/dev/console". It starts writing corresponding logs to
this descriptor.
3- Later during the boot sequence, init(8) configures the console, and for this
to be done, it starts by calling the revoke(2) syscall: revoke("/dev/console")
is the first line of code in /usr/src/sbin/init/init.c:open_console().
4- Once /dev/console is revoked, further writes to any file descriptor
previously opened on this file return -1 with ENXIO as errno.
5- thus, rsyslogd gets this error in runtime/Stream.c:doWriteCall(), and calls
runtime/stream.c:tryTTYRecover() since the error occured on a tty.
6- but runtime/stream.c:tryTTYRecover() tries to reopen the tty only if the
error is EIO on Linux or EBADF on any other operating system. Since the error
is ENXIO, that is distinct from EBADF, runtime/stream.c:tryTTYRecover() returns
RS_RET_OK and runtime/stream.c:doWriteCall() loops, endlessly.
Sincerely,
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list