From owner-freebsd-ports-bugs@FreeBSD.ORG Sun May 24 18:11:35 2015 Return-Path: Delivered-To: freebsd-ports-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9BBE69F9 for ; Sun, 24 May 2015 18:11:35 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 846A11072 for ; Sun, 24 May 2015 18:11:35 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OIBZXe030847 for ; Sun, 24 May 2015 18:11:35 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 200429] sysutils/rsyslog8 endless loop when started at boot time with some rules to write on the console Date: Sun, 24 May 2015 18:11:35 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: fbsd.bugzilla@fenyo.net X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: brd@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 18:11:35 -0000 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@FreeBSD.org Reporter: fbsd.bugzilla@fenyo.net Flags: maintainer-feedback?(brd@FreeBSD.org) Assignee: brd@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.