Bug 506683 - syslogd stops writing any messages to /dev/console after an EINTR in syscall
Summary: syslogd stops writing any messages to /dev/console after an EINTR in syscall
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sysklogd
Version: 5.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 5.5
Assignee: Peter Vrabec
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On: 500354
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-18 10:08 UTC by Olivier Fourdan
Modified: 2018-10-27 14:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 500354
Environment:
Last Closed: 2010-03-30 08:15:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (3.92 KB, patch)
2009-06-18 10:08 UTC, Olivier Fourdan
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0211 0 normal SHIPPED_LIVE sysklogd bug fix update 2010-03-29 12:29:55 UTC

Description Olivier Fourdan 2009-06-18 10:08:52 UTC
Created attachment 348404 [details]
Proposed patch

+++ This bug was initially created as a clone of Bug #500354 +++

Description of problem:

The fix for bug #140983 makes system calls interruptible with SIGALRM.

But if that signal is triggered during a writev() (which can happen when writing so a slow console via serial), syslog will print a message "/dev/console: Interrupted system call" and stop logging to console.

Version-Release number of selected component (if applicable):

sysklogd-1.4.1-26_EL

How reproducible:

Just once in the customer's environment.
100% with following reproducer

Steps to Reproduce:

1. Connect the serial console
2. Edit /etc/syslog.conf as follows to have syslogd write many messages to
   /dev/console.

---
[/etc/syslog.conf]
*.debug               /dev/console
---

3. On the another system where the serial is connected, run "cu" as console:

  # cu -l ttyS0 -s 9600 -o -e

  (note: cu comes with the "uucp" package)

4. Execute the following example program to log messages continuously to syslog.

  $ for i in $(seq 1 500); do logger test $i; done

5. Suspend the output on the other system with "ctrl-s"

Actual Results:

After a random amount of time (t < 30s), either the messages get truncated or  syslog will stop logging to the console.

Expected Results:

The messages are not truncated and there is at least a 30 secs grace time before syslog gives up and closes the file descriptor to the console.

Additional info:

The problem occurs because the sigalrm() is not set before calling writev() in syslog and may occur at any time. If the alarm is triggered during the writev(), the file descriptor is closed and syslog will not log anymore.

Also, if the I/O buffer gets full, writev() will not send the entirety of the message to the log, causing messages to be truncated.

The proposed patch avoids both problems by:

  - Rescheduling the ALARM just prior to call writev() to make avoid a signal
    coming up during the writev()
  - Recomputing iovec when writev() could not write all data to avoid
    messages being half written to the log.

Customer confirmed the fix in bz#500354 - The patch is not entirely identical to the one in bz#500354 as the code is slightly different between syslog for el4 and el5.

Comment 1 Olivier Fourdan 2009-06-18 10:20:25 UTC
Version-Release number of selected component (if applicable):

sysklogd-1.4.1-44.el5

Comment 5 Chris Ward 2010-02-10 08:39:01 UTC
@Oliver, @GSS

Could we ask the customer to test Beta bits to confirm this issue has been fixed?

Thanks!

Comment 9 Chris Ward 2010-02-11 10:18:51 UTC
~~ Attention Customers and Partners - RHEL 5.5 Beta is now available on RHN ~~

RHEL 5.5 Beta has been released! There should be a fix present in this 
release that addresses your request. Please test and report back results 
here, by March 3rd 2010 (2010-03-03) or sooner.

Upon successful verification of this request, post your results and update 
the Verified field in Bugzilla with the appropriate value.

If you encounter any issues while testing, please describe them and set 
this bug into NEED_INFO. If you encounter new defects or have additional 
patch(es) to request for inclusion, please clone this bug per each request
and escalate through your support representative.

Comment 13 errata-xmlrpc 2010-03-30 08:15:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0211.html


Note You need to log in before you can comment on or make changes to this bug.