[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zmailer problems / questions



In message <Pine.3.89.9404291216.D342-0100000@jhunix2.hcf.jhu.edu> you write:
>On Fri, 29 Apr 1994, John Scharbe wrote:
>> the router process has a huge memory leak that in the course of 24 hours
>> uses all physical and swap memory.  I've already added swap and taken to
>> restarting zmailer daily, but its not very pretty and we are still at
>> real low volume.  
>> 
>> Question: Has any one seen this problem before and know an answer ?
>
>I see this problem (SGI IRIX 4.0.4).  We run 5 router processes and only
>some of them will bloat.  And it usually takes a couple of days to happen. 
>I have taken the same approach to working around it but it IS a problem. 
>I too am faced with setting up a huge mail machine and would like to use
>ZMAILER but this memory problem has me concerned. 

This quite possibly is the .forward problem that Ken Lalonde posted a patch 
for in Feb. 

I'm including Ken's post at the end of this message. Try his patch and see
if the problem persists.

Regards,

John
--
John DiMarco                                              jdd@cdf.toronto.edu
Computing Disciplines Facility Systems Manager            jdd@cdf.utoronto.ca
University of Toronto                                     EA201B,(416)978-1928


Received: from relay.cs.toronto.edu ([128.100.1.105]) by marvin.cdf.toronto.edu with SMTP id <31031>; Fri, 11 Feb 1994 08:51:55 -0500
Received: from neat.cs.toronto.edu ([128.100.3.2]) by relay.cs.toronto.edu with SMTP id <428501>; Fri, 11 Feb 1994 08:45:33 -0500
Received: by neat.cs.toronto.edu id <48148>; Fri, 11 Feb 1994 08:45:31 -0500
From:	Ken Lalonde <ken@cs.toronto.edu>
To:	zmailer@cs.toronto.edu
Subject: .forward files w/o newlines cause router memory leak (+fix)
Message-Id: <94Feb11.084531est.48148@neat.cs.toronto.edu>
Date:	Fri, 11 Feb 1994 08:45:26 -0500

A local emacs fan set up his .forward file without a newline.
After a few days the router process on that machine consumed
all available memory and hung.

I traced the problem to lib/linebuffer.c.  The function getline()
attempts to read a line of arbitrary length.  If the file has
no newline, the internal buffer used by getline doubles in size.

This patch grows the buffer only when it's full.

Cheers,

	Ken Lalonde, Dept. of Computer Science, University of Toronto


*** linebuffer.c.old	Thu Feb 10 10:13:39 1994
--- linebuffer.c	Fri Feb 11 07:15:37 1994
***************
*** 60,66 ****
  	/* assert block != NULL */
  	if (blen <= 0 || bend >= block + bsize) {
  		blen = fread((char *)block, 1, (int)bsize, fp);
! 		if (blen <= 0)
  			return 0;
  		bend = block;
  	}
--- 60,66 ----
  	/* assert block != NULL */
  	if (blen <= 0 || bend >= block + bsize) {
  		blen = fread((char *)block, 1, (int)bsize, fp);
! 		if (blen == 0)
  			return 0;
  		bend = block;
  	}
***************
*** 77,86 ****
  		if (bend > block)
  			bcopy((char *)bend, (char *)block, (int)blen);
  		/* get some more bytes which will hopefully contain a newline */
! 		bsize *= 2;
! 		block = (u_char *)erealloc((char *)block, bsize);
! 		n = fread((char *)(block+blen), 1, (int)bsize/2, fp);
! 		if (n <= 0) {
  			/* the file doesn't terminate in a newline */
  			n = blen;
  			blen = 0;
--- 77,90 ----
  		if (bend > block)
  			bcopy((char *)bend, (char *)block, (int)blen);
  		/* get some more bytes which will hopefully contain a newline */
! 		n = bsize - blen;
! 		if (n <= 0) {		/* grow the buffer */
! 			n = bsize;
! 			bsize *= 2;
! 			block = (u_char *)erealloc((char *)block, bsize);
! 		}
! 		n = fread((char *)(block+blen), 1, n, fp);
! 		if (n == 0) {
  			/* the file doesn't terminate in a newline */
  			n = blen;
  			blen = 0;