[syslog-ng]syslog-ng TCP bug

Balazs Scheidler bazsi@balabit.hu
Fri, 1 Sep 2000 12:14:04 +0200


On Thu, Aug 31, 2000 at 03:48:01PM -0400, Scott McDermott wrote:
> Nate Campi on Thu 31/08 12:05 -0700:
> > Every hour at exactly 30 minutes past the hour (7:30, 8:30, 9:30, etc)
> > syslog-ng dies with the error:
> > 
> > syslog-ng: io.c:172: io_iter: Assertion `i < nfds' failed.
> 
> Yes, we have the same problem here.  But I never compiled debugging
> symbols into by binary yet so I couldn't get the line number (and there
> I think three of those assertions in that routine)

try to apply this patch to your libol:

Index: io.c
===================================================================
RCS file: /var/cvs/libol/src/io.c,v
retrieving revision 1.21
diff -u -r1.21 io.c
--- io.c	2000/06/23 12:55:51	1.21
+++ io.c	2000/09/01 10:09:38
@@ -97,11 +97,9 @@
 	int timeout = -1;
 	time_t now = time(NULL);
 	
-	nfds = 0;
 	
 	{
-		/* Prepare fd:s. This fase calls the prepare-methods, also 
-closes
+		/* Prepare fd:s. This fase calls the prepare-methods, also  closes
 		 * and unlinks any fd:s that should be closed, and also counts how
 		 * many fd:s there are. */
 		
@@ -140,7 +138,6 @@
 				*fd_p = fd->next;
 				continue;
 			}
-			nfds++;
 			fd_p = &fd->next;
 		}
 		
@@ -155,6 +152,15 @@
 			if (timeout == -1 || (n->when - now < timeout)) {
 				timeout = n->when - now;
 			}
+		}
+	}
+	nfds = 0;
+
+	{
+		struct nonblocking_fd *fd;
+
+		for(fd = b->files; fd; fd = fd->next) {
+			nfds++;
 		}
 	}
 


> > Then at 31 minutes past the hour my "syslog-ng.check" script (running
> > from cron every minute) sees that syslog-ng isn't running and restarts
> > it. syslog-ng runs fine for another hour, then at 30 minutes past the
> > next hour it dies again, and the cycle continues.
> 
> I also have a script that restarts syslog-ng every hour :) Otherwise, it
> crashes 3-4 times per day, and leaks memory like a seive.  I gave up
> trying to find the problem because of the strange libol junk.

I understand that libol may be a bit cumbersome for someone new to garbage
collectors and such. I've silently released 1.4.6 of syslog-ng, my crashtest
was the following:

I had two computers: szundi and kuka both of them running syslog-ng. szundi
sent its logs to kuka using a TCP connection. Two instances of stresstest.sh
(found in the /doc directory, modified to loop forever) was running
continuosly on szundi, and a single instance on kuka. Every 20 minutes a HUP
signal was sent to both hosts. syslog-ng didn't leak on either one.

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
     url: http://www.balabit.hu/pgpkey.txt