Bug 506683 - syslogd stops writing any messages to /dev/console after an EINTR in syscall
syslogd stops writing any messages to /dev/console after an EINTR in syscall
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sysklogd (Show other bugs)
5.3
All Linux
medium Severity medium
: rc
: 5.5
Assigned To: Peter Vrabec
BaseOS QE
: Patch
Depends On: 500354
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-18 06:08 EDT by Olivier Fourdan
Modified: 2015-05-11 07:45 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 500354
Environment:
Last Closed: 2010-03-30 04:15:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Olivier Fourdan 2009-06-18 06:08:52 EDT
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 06:20:25 EDT
Version-Release number of selected component (if applicable):

sysklogd-1.4.1-44.el5
Comment 5 Chris Ward 2010-02-10 03:39:01 EST
@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 05:18:51 EST
~~ 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 04:15:52 EDT
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.