🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #20737

Re: What affects innd's memory size at equilibrium and why may it change dramatically?

#20737
From: Marc Slemko
Date: Wed, 20 Aug 1997 00:00
114 lines
5081 bytes
In <5tf4fn$852$1@news.theriver.com> marcus@theriver.com (Marcus Needham) writes:

>>Are you sure overchan is not backlogging?

>I do not think so (I see no batches in out.going for it) but I will turn it 
>off for a short while and see what happens.

>Last night it grew to 150MB then failed and exited trying to grab another 
>chunk:
>Aug 20 06:46:34 news innd: SERVER cant remalloc 67110144 bytes Cannot 
>allocate memory

>Ring any bells?

You could try the following two patches.  The second will tell you
where (ie. source file and line number) innd is trying to remalloc
from.  I found that my overchan channel was growing huge, even
though there wasn't much data left in it.  eg.  30 meg buffer, 20k
of data in it.

The first patch fixes some of that.  First, it allocates the buffer
in chunks of at least 64k instead of the default 1k.  If you don't
change this, innd does a horrible number of remalloc()s.  It also
means you get 64 times more debug messages from the second patch.
The other thing the first patch does is attempt to compact
the buffer instead of allocating more memory.  This helped a _lot_
for some buffers.

You should apply Jerry Aguirre's overchan backlog patch 
(in ftp://ftp.isc.org/isc/inn/unoff-patches/1.5.1/ with a 
name of innd-fix-for-overchan-backlogs.patch) if it isn't
in the version you are using.  Even with it, however, my
channel buffers were still growing far larger than necessary.

Oh, to get the below change to macros.h to compile with all the
source files (ie. not just innd) you have to add a bunch of #include
<syslog.h>s around.

If, as you say in another post, your history.pag file is growing
a lot then you have other problems... Barry gives details in his
post.

Index: innd.h
===================================================================
RCS file: /home/marcs/cvs/inn/innd/innd.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 innd.h
*** innd.h	1997/07/13 05:32:48	1.1.1.1
--- innd.h	1997/08/18 22:58:34
***************
*** 339,347 ****
  	    /* Note end of buffer, grow it if we need more room. */ \
  	    i_ = bp_->Used + bp_->Left; \
  	    if (i_ + l_ > bp_->Size) { \
! 		/* Round size up to next 1K. */ \
! 		bp_->Size += (l_ + 0x3FF) & ~0x3FF; \
! 		RENEW(bp_->Data, char, bp_->Size); \
  	    } \
  	    bp_->Left += l_; \
  	    if (l_ > MEMCPY_THRESHOLD) \
--- 343,362 ----
  	    /* Note end of buffer, grow it if we need more room. */ \
  	    i_ = bp_->Used + bp_->Left; \
  	    if (i_ + l_ > bp_->Size) { \
! 	        if ( (bp_->Used > (bp_->Size/10)) && (bp_->Used > 256*1024)) { \
! 		    /* compact the buffer, shoving the \
! 		       data back to the beginning. \
! 		       <rmtodd@mailhost.ecn.ou.edu> */ \
! 		    syslog(L_NOTICE, "DEBUG: innd.h: about to shrink buffer, bp_->Used = %d, bp_->Left = %d, bp_->Size = %d", bp_->Used, bp_->Left, bp_->Size); \
! 		    BUFFset(bp_, &bp_->Data[bp_->Used], bp_->Left); \
! 		    syslog(L_NOTICE, "DEBUG: innd.h: finished shrinking buffer, bp_->Used = %d, bp_->Left = %d, bp_->Size = %d", bp_->Used, bp_->Left, bp_->Size); \
! 		    i_ = bp_->Used + bp_->Left; \
! 		} \
! 		if (i_ + l_ > bp_->Size) { \
! 		    /* Round size up to next 64k. */ \
! 		    bp_->Size += (l_ + 0xFFFF) & ~0xFFFF; \
! 		    RENEW(bp_->Data, char, bp_->Size); \
! 		} \
  	    } \
  	    bp_->Left += l_; \
  	    if (l_ > MEMCPY_THRESHOLD) \



Index: macros.h
===================================================================
RCS file: /home/marcs/cvs/inn/include/macros.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 macros.h
*** macros.h	1997/07/13 05:32:44	1.1.1.1
--- macros.h	1997/08/18 22:47:31
***************
*** 27,33 ****
  	((T *)xmalloc((unsigned int)(sizeof (T) * (c))))
  
  #define RENEW(p, T, c)			\
!         (p = (T *)xrealloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
  
  /* =()<#define DISPOSE(p)		free((@<POINTER>@ *)p)>()= */
  #define DISPOSE(p)		free((void *)p)
--- 27,36 ----
  	((T *)xmalloc((unsigned int)(sizeof (T) * (c))))
  
  #define RENEW(p, T, c)			\
! { \
!     syslog(LOG_NOTICE, "RENEW: %s:%d: trying to realloc %d bytes", __FILE__, __LINE__, c); \
!     (p = (T *)xrealloc((char *)(p), (unsigned int)(sizeof (T) * (c)))); \
! }
  
  /* =()<#define DISPOSE(p)		free((@<POINTER>@ *)p)>()= */
  #define DISPOSE(p)		free((void *)p)

Technical Details
Message-ID: <5tf9cu$qn6$1@scanner.worldgate.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <5tcnc0$j4u$1@news.theriver.com> <5tdj2g$m2l$1@news1.epix.net> <5tf4fn$852$1@news.theriver.com>

Show Full Headers
Complete Article Headers
Message-ID: <5tf9cu$qn6$1@scanner.worldgate.com>
Subject: Re: What affects innd's memory size at equilibrium and why may it change dramatically?
Date: Wed, 20 Aug 1997 00:00:00 +0000
From: Marc Slemko <marcs@znep.com>
References: <5tcnc0$j4u$1@news.theriver.com> <5tdj2g$m2l$1@news1.epix.net> <5tf4fn$852$1@news.theriver.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 265520666
Organization: WorldGate Inc. http://www.worldgate.com/
Newsgroups: news.software.nntp