bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-inetutils] syslog - blocks all procceses by a infinite read after p


From: D. Lehne
Subject: [bug-inetutils] syslog - blocks all procceses by a infinite read after poll
Date: Thu, 01 Mar 2012 13:35:21 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Hello,

in relation to a feature of circular log (clog) for syslog, i've seen a strange behavior on the system resulting by syslog.

The system is a:
Linux 4S 2.6.33.7.2-rt30-A4-2011.02.0 #1 PREEMPT RT Tue Feb 7 17:39:13 CET 2012 armv6l GNU/Linux

Syslog is from inetutil-1.6:
address@hidden:~#ldd /sbin/syslogd
        libresolv.so.2 => /lib/libresolv.so.2 (0x40026000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x4003a000)
        libc.so.6 => /lib/libc.so.6 (0x40056000)
        /lib/ld-linux.so.3 (0x40000000)

After syslog started the following situation happens. Syslog returns from poll(), by an unknown sender, for a /proc/kmsg event of the fd but there is no data to read and syslog reads infinite. All other processes sending to syslog (like /dev/log) are blocked until a message is sended to /proc/kmsg. This lock happens once after 20 or more restarts, that means it is really rarly.

This is the strace of syslog:

address@hidden:~#cat /tmp/sys1trace
read(3,<unfinished ...>
address@hidden:~#ls -l /proc/498/fd
lr-x------    1 root     root            64 Feb 28 15:54 3 ->  /proc/kmsg

This is a strace of a application:

address@hidden:/proc/496#cat /tmp/armtrace
send(6, "<134>Feb 28 13:47:19 : 28/02/12 "..., 99, MSG_NOSIGNAL<unfinished ...>

The file discriptor handling is done in main():

for (;;)

    {

      int nready;

      nready = poll (fdarray, nfds, -1);

      if (nready == 0)          /* ??  noop */

        continue;
...
      for (i = 0; i<  nfds; i++)
        if (fdarray[i].revents&  (POLLIN | POLLPRI))
          {
            int result;
            size_t len;
            if (fdarray[i].fd == -1)
              continue;
            else if (fdarray[i].fd == fklog)
              {
                result = read (fdarray[i].fd,&kline[kline_len],
                               sizeof (kline) - kline_len - 1);
...

The file discriptor fklog represent /proc/kmsg. The fdarray consist actually only of 2 active file descriptors, one is proc/kmsg and the other dev/log. The read function blocks further processing.

The kernel man says for /proc/kmsg:

/proc/kmsg
              ..., and only one process should read this file.  This file 
should not be read if a syslog process is running which uses the syslog(2) sys‐
              tem call facility to log kernel messages.


My questions are the following:

1. Which other processes are working with /proc/kmsg?
2. Why poll() is used and not ppoll() ?
3. My patch is working with pwritev(), does it have influences on poll() ?
4. Any suggest for a further/better debugging?

Best regards!

--
D. Lehne
Dep. Development

AMK Drives and Controls Ltd.
Bulgaria / Gabrovo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]