[syslog-ng] syslog-ng 2.0.4 hang

Balazs Scheidler bazsi at balabit.hu
Wed Jul 18 16:34:00 CEST 2007


On Wed, 2007-07-18 at 13:09 +0100, Geller, Sandor (IT) wrote:
> Hi,
> 
> > On Tue, 2007-07-17 at 15:20 +0100, Geller, Sandor (IT) wrote:
> > > > Hi,
> > > > 
> > > > I've encountered a strange problem. I'm using syslog-ng 2.0.4 with
> > > > a fairly basic setup, and syslog-ng hangs when it is reading from
> > > > /proc/kmsg, but only right after boot and only on one of 
> > my machines,
> > > > which is a RHEL AS3 machine.
> > > > 
> > > > It is reproducible, the host hangs on every boot as every process
> > > > which tries to write to /dev/log gets blocked.
> > > > 
> > > > Has anyone seen such behaviour?
> > > 
> > > Replying to myself: adding log_fetch_limit(1) for the 
> > /proc/kmsg source
> > > solved the issue.
> > 
> > Hmm... this should not be happening, the file() source does not use
> > fetch_limit(), it basically forces the use of a single read 
> > system call.
> > (by using the LR_NOMREAD flag)
> > 
> > This was implemented before 1.9.11, so it's been a long time, 
> > since this
> > is integrated.
> > 
> > Are you sure this was the cause? Can you check if syslog-ng actually
> > issues multiple read() system calls without checking for readability?
> 
> The output of strace showed that a read was called without a prior poll.
> I've sent the configuration and the strace outputs in a private mail.
> 

Here's the fix, that I've commited now. Can you check if it indeed fixes
the problem? Thanks.

diff --git a/src/logreader.c b/src/logreader.c
index e797223..c7ddf83 100644
--- a/src/logreader.c
+++ b/src/logreader.c
@@ -323,8 +323,10 @@ log_reader_fetch_log(LogReader *self, FDRead *fd)
     {
       log_reader_iterate_buf(self, NULL, FALSE, &msg_count);
       
-      /* we still have something */
-      if (self->ofs != 0)
+      /* we still have something that could not be emptied, or multiread is
+       * disabled and we did not check readability when we came here.
+       */
+      if (self->ofs != 0 || (self->flags & LR_NOMREAD))
         return TRUE;
     }
   


-- 
Bazsi



More information about the syslog-ng mailing list