🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
31 messages
31 total messages Started by Dave Pascoe Mon, 02 Jun 1997 00:00
INN-1.5.1 dying
#18169
Author: Dave Pascoe
Date: Mon, 02 Jun 1997 00:00
19 lines
1241 bytes
I just installed INN-1.5.1 a few days ago with many of the patches
from unoff-patches.  Once or twice a day for the last few days innd
has been dying mysteriously.  The logs haven't been too revealing.
I'm still trying to trace down why it's dying.

Has anyone else had this problem with 1.5.1+patches on a Solaris 2.5
box?  I doubt that it's Solaris-related, but thought I'd mention it
anyway.

Now I'm wishing I stayed at 1.4unoff4+patches....if I can't find and
fix the 1.5.1 problem, it's back to 1.4 for me.

-- 
Dave Pascoe  | mailto:dave@mathworks.com  |  Voice: 508.647.7362
KM3T         | http://www.mathworks.com   |    FAX: 508.647.7002
PGP fingerprint: 53 AD 71 88 2F AA 45 AC D0 2E 68 91 71 77 39 AF

Re: INN-1.5.1 dying
#18136
Author: Jeff Garzik
Date: Mon, 02 Jun 1997 00:00
337 lines
10230 bytes
This is a multi-part message in MIME format.

--------------5E7231E2664EC1B6C398B18
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here's what I have.  The patch you posted was already diff'd by J.
Porter Clark at
ftp://ftp.isc.org/isc/inn/unoff-patches/canceled-history-arrival-time.patch 
:)

My patch conflicts with the above patch, and includes
ftp://ftp.isc.org/isc/inn/unoff-patches/null-pointer.patch

It models itself after Clayton O'Neill's patch, but stores hash values
instead of copying the msg id string each time.  It also adds cache
stats and logging of said stats, and some warnings to debug the history
cache code.

It still crashes...
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

--------------5E7231E2664EC1B6C398B18
Content-Type: text/plain; charset=us-ascii; name="history-cache.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="history-cache.patch"

*** ../inn-plain/innd/his.c	Tue Dec 17 09:40:40 1996
--- innd/his.c	Mon Jun  2 07:50:20 1997
***************
*** 1,4 ****
! /*  $Revision: 1.23 $
  **
  **  History file routines.
  */
--- 1,4 ----
! /*  $Revision: 1.2 $
  **
  **  History file routines.
  */
***************
*** 9,21 ****
  #include "innd.h"
  #include "dbz.h"
  
  
  STATIC char	HIShistpath[] = _PATH_HISTORY;
  STATIC FILE	*HISwritefp;
  STATIC int	HISreadfd;
  STATIC int	HISdirty;
  STATIC int	HISincore = INND_DBZINCORE;
! 
  
  /*
  **  Set up the history files.
--- 9,31 ----
  #include "innd.h"
  #include "dbz.h"
  
+ #define HISCACHESIZE	(256 * 1024L) /* num. elements in cache array */
+ #define HISCACHELOGTIME	500 /* seconds between cache hit reports to syslog */
+ 
+ typedef struct {
+     long		MessageIDHash;
+     BOOL		Found;
+ } _HIScache;
  
  STATIC char		HIShistpath[] = _PATH_HISTORY;
  STATIC FILE		*HISwritefp;
  STATIC int		HISreadfd;
  STATIC int		HISdirty;
  STATIC int		HISincore = INND_DBZINCORE;
! STATIC _HIScache	HIScache[HISCACHESIZE];
! STATIC unsigned long	HIScachehits;
! STATIC unsigned long	HIScachelookups;
! STATIC time_t		HIScachelastreported;
  
  /*
  **  Set up the history files.
***************
*** 46,51 ****
--- 56,66 ----
  	    exit(1);
  	}
      }
+ 
+     syslog(L_NOTICE, "SERVER history cache reset: %ld entries", HISCACHESIZE);
+     memset((void *)&HIScache, 0, sizeof(HIScache));
+     HIScachehits = HIScachelookups = 0;
+     HIScachelastreported = Now.time;
  }
  
  
***************
*** 84,89 ****
--- 99,107 ----
  	    syslog(L_ERROR, "%s cant close history %m", LogName);
  	HISreadfd = -1;
      }
+ 
+   syslog(L_NOTICE, "SERVER history cache final: %lu lookups, %lu hits",
+   	 HIScachelookups, HIScachehits);
  }
  
  
***************
*** 198,206 ****
--- 216,253 ----
  {
      datum	key;
      datum	val;
+     long	hash_pos, hash_val;
+ 
+     if ((MessageID == NULL) || (*MessageID == 0)) {
+       syslog(L_ERROR, "SERVER HIShavearticle(): missing message id");
+       return FALSE;
+     }
+ 
+     hash_val = dbzhash(MessageID, strlen(MessageID));
+     hash_pos = hash_val % HISCACHESIZE;
+     if ((hash_pos < 0) || (hash_pos >= HISCACHESIZE))
+       syslog(L_FATAL, "SERVER HIShavearticle(): invalid hash_pos: %ld", hash_pos);
+     HIScachelookups++;
+     if (HIScache[hash_pos].MessageIDHash == hash_val) {
+ 	HIScachehits++;
+ 
+ 	if (Now.time > (HIScachelastreported + HISCACHELOGTIME)) {
+ 	  syslog(L_NOTICE,
+ 	  	 "SERVER history cache: %lu lookups, %lu hits",
+ 	  	 HIScachelookups,
+ 		 HIScachehits);
+ 
+ 	  HIScachelastreported = Now.time;
+ 	}
+ 
+     	return HIScache[hash_pos].Found;
+     }
  
      HISsetkey(MessageID, &key);
      val = dbzfetch(key);
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = (char)(val.dptr != NULL);  
      return val.dptr != NULL;
  }
  
***************
*** 237,247 ****
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset;
      datum		key;
      datum		val;
      int			i;
  
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
--- 284,297 ----
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset, hash_val, hash_pos;
      datum		key;
      datum		val;
      int			i;
  
+     if ((Data->MessageID == NULL) || (Data->MessageIDLength < 1))
+       return FALSE;
+ 
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
***************
*** 279,284 ****
--- 329,342 ----
  	return FALSE;
      }
  
+     hash_val = dbzhash(Data->MessageID, Data->MessageIDLength);
+     hash_pos = hash_val % HISCACHESIZE;
+     if ((hash_pos < 0) || (hash_pos >= HISCACHESIZE))
+       syslog(L_FATAL, "SERVER HISwrite(): invalid hash_pos: %ld", hash_pos);
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = TRUE;
+     
      if (++HISdirty >= ICD_SYNC_COUNT)
  	HISsync();
      return TRUE;
*** ../inn-plain/innd/art.c	Tue Dec 17 09:40:40 1996
--- innd/art.c	Mon Jun  2 05:18:59 1997
***************
*** 1784,1790 ****
  	(void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, error);
  	ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!         if (Mode == OMrunning && !HISwrite(&Data, ""))
              syslog(L_ERROR, "%s cant write history %s %m",
                     LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
--- 1784,1790 ----
  	(void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, error);
  	ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!         if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data, ""))
              syslog(L_ERROR, "%s cant write history %s %m",
                     LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
***************
*** 1799,1805 ****
          syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff);
          ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!         if (Mode == OMrunning && !HISwrite(&Data, ""))
              syslog(L_ERROR, "%s cant write history %s %m",
                     LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
--- 1799,1805 ----
          syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff);
          ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!         if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data, ""))
              syslog(L_ERROR, "%s cant write history %s %m",
                     LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
***************
*** 1843,1849 ****
                         buff);
  		ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!                 if (Mode == OMrunning && !HISwrite(&Data, ""))
                      syslog(L_ERROR, "%s cant write history %s %m",
                             LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
--- 1843,1849 ----
                         buff);
  		ARTlog(&Data, ART_REJECT, buff);
  #if	defined(DO_REMEMBER_TRASH)
!                 if (Data.MessageID && Mode == OMrunning && !HISwrite(&Data, ""))
                      syslog(L_ERROR, "%s cant write history %s %m",
                             LogName, Data.MessageID);
  #endif	/* defined(DO_REMEMBER_TRASH) */
*** ../inn-plain/innd/cc.c	Tue Dec 17 09:40:40 1996
--- innd/cc.c	Mon Jun  2 05:21:16 1997
***************
*** 410,416 ****
      ARTDATA	Data;
      STRING	p;
  
!     Data.Posted = Now.time;
      Data.Expires = 0;
      Data.Feedsite = "?";
      if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)
--- 410,417 ----
      ARTDATA	Data;
      STRING	p;
  
!     memset ((void *)&Data, 0, sizeof(Data));
!     Data.Posted = Data.Arrived = Now.time;
      Data.Expires = 0;
      Data.Feedsite = "?";
      if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)
*** ../inn-plain/dbz/dbz.c	Tue Dec 17 09:40:40 1996
--- dbz/dbz.c	Mon Jun  2 05:24:59 1997
***************
*** 355,361 ****
  extern void CloseOnExec();
  
  /* misc. forwards */
- static long hash();
  static void crcinit();
  static char *cipoint();
  static char *mapcase();
--- 355,360 ----
***************
*** 1426,1432 ****
  {
  	register long h;
  
! 	h = hash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
--- 1425,1431 ----
  {
  	register long h;
  
! 	h = dbzhash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
***************
*** 1716,1725 ****
  }
  
  /*
!  - hash - Honeyman's nice hashing function
   */
! static long
! hash(name, size)
  register char *name;
  register int size;
  {
--- 1715,1724 ----
  }
  
  /*
!  - dbzhash - Honeyman's nice hashing function
   */
! long
! dbzhash(name, size)
  register char *name;
  register int size;
  {
*** ../inn-plain/dbz/dbz.h	Tue Dec 17 09:40:40 1996
--- dbz/dbz.h	Mon Jun  2 05:24:59 1997
***************
*** 24,29 ****
--- 24,30 ----
  extern int dbzcancel();
  extern int dbzdebug();
  extern int dbzwritethrough();
+ extern long dbzhash();
  
  /*
   * In principle we could handle unlimited-length keys by operating a chunk

--------------5E7231E2664EC1B6C398B18--


Re: INN-1.5.1 dying
#18140
Author: C.S.Chen
Date: Mon, 02 Jun 1997 00:00
54 lines
2969 bytes
Dave Pascoe (dave.nospam.maam@mathworks.com) ����:
: I just installed INN-1.5.1 a few days ago with many of the patches
: from unoff-patches.  Once or twice a day for the last few days innd
: has been dying mysteriously.  The logs haven't been too revealing.
: I'm still trying to trace down why it's dying.

We'd suffered from some similar problem while upgrading from INN-1.4unoff4
to 1.5.1 on both HP-UX 9.03 & Solaris 2.5 systems.

We'd applied some patches, but none to "innd".
- In fact, we'd once tried the "abp" patch.  However, in order to study
  the problem, we'd removed it and backed to the original program files.

After some checking of the "config.data" file, I found that, by default,
the "IPADDR_LOG" flag is turned on in the sample-config file.
--> this seems to be the most likely variable to cause the problem.

    It seems that the system call gethostbyaddr() (and many related) cost
    the whole system a lot of time/resource to finish the job...

  ( This flag was diabled in my old INN-1.4unoff4 configuration file ).

Once the flag is turned off and the system being re-compiled and installed.
Now the systems work smoothly.

To fix your problem, I'd suggest that you should check your config.data.
   -make sure the flag "IPADDR_LOG" is disabled.
------------------------------------------------------------------
##  Log by host IP address, rather than from Path line?
#### =()<IPADDR_LOG             @<IPADDR_LOG>@>()=
IPADDR_LOG              DONT
------------------------------------------------------------------

BTW, I'd suggest that you first try this with both TCL & PERL filtering
turned off. Once you are sure the system is able to run smoothly for
a day or two, then you could try enable these filtering options again.

- We'd once wonder if the system resource of our systems are not
  enough to support this new configuration. INN 1.5.1 is new. TCL
  filtering support is new. PERL filtering support is new...

: Has anyone else had this problem with 1.5.1+patches on a Solaris 2.5
: box?  I doubt that it's Solaris-related, but thought I'd mention it
: anyway.

Maybe, you should check the "/etc/nsswitch.conf", too.  
The syntax is a little too complicate for un-familiar people. Some even 
said that some of the options had bugs in them. ( the fallback option ).

-- 
Joe. C.S.Chen, cschen@ns.nctu.edu.tw

Re: INN-1.5.1 dying
#18144
Author: Jeff Garzik
Date: Mon, 02 Jun 1997 00:00
32 lines
2218 bytes
Marcus Needham wrote:
> I do however have a problem with INN
> exiting apparently when it receives a message larger then MAX_ART_SIZE.


What version are you running?  1.5.1 appears to work when MAX_ART_SIZE
and LOCAL_MAX_ARTSIZE are the same (1000000 on this test system):

Jun  1 20:11:04 pretzel innd: news.spinne.com:19 internal rejecting huge
article <5mrtai$n82@panix3.panix.com> (1941760 > 1000000)
Jun  1 20:38:31 pretzel innd: news.spinne.com:16 internal rejecting huge
article <19970601213001$zbbfr@cm.org> (3513586 > 1000000)
Jun  1 20:50:14 pretzel innd: news.spinne.com:18 internal rejecting huge
article <19970601203001$zbbfr@cm.org> (5502722 > 1000000)
Jun  1 20:51:35 pretzel innd: news.spinne.com:16 internal rejecting huge
article <X970601152144hweede@unlisys.unlisys.net> (6258731 > 1000000)
Jun  1 22:33:22 pretzel innd: news.spinne.com:16 internal rejecting huge
article <970601152956hweede@unlisys.unlisys.net> (2000297 > 1000000)
Jun  1 22:55:35 pretzel innd: news.spinne.com:18 internal rejecting huge
article <y970601152956hweede@unlisys.unlisys.net> (2703583 > 1000000)
Jun  1 23:25:22 pretzel innd: news.spinne.com:16 internal rejecting huge
article <19970602030001$zbbfr@cm.org> (4587767 > 1000000)
Jun  1 23:31:11 pretzel innd: news.spinne.com:18 internal rejecting huge
article <01bc6f08$43a46500$1d2192cf@pat-darnall> (1765539 > 1000000)

-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

Re: INN-1.5.1 dying
#18145
Author: Jeff Garzik
Date: Mon, 02 Jun 1997 00:00
261 lines
7142 bytes
This is a multi-part message in MIME format.

--------------29E5AA957A2579D2DECFDBB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

coneill@blah.erols.com wrote:
> Jeff Garzik <jeff.garzik@spinne.com> writes:

> > It models itself after Clayton O'Neill's patch, but stores hash values
> > instead of copying the msg id string each time.  It also adds cache
> > stats and logging of said stats, and some warnings to debug the history
> > cache code.

> > It still crashes...
> > +     hash_val = dbzhash(Data->MessageID, Data->MessageIDLength);

> This line is probably the problem.  MessageIDLength is not always valid.
> You need to replace Data->MessageIDLength with strlen(Data->MessageID).


That's exactly the problem.  In CCcancel() and one other place,
Data->MessageID is set without setting the respective
Data->MessageIDLength variable.

I have attached the corrected version of the patch.  I've been running
this for about 12 hours without any problems.
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

--------------29E5AA957A2579D2DECFDBB
Content-Type: text/plain; charset=us-ascii; name="history-cache.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="history-cache.patch"

*** ../inn-plain/innd/his.c	Tue Dec 17 09:40:40 1996
--- innd/his.c	Mon Jun  2 10:48:51 1997
***************
*** 1,4 ****
! /*  $Revision: 1.23 $
  **
  **  History file routines.
  */
--- 1,4 ----
! /*  $Revision: 1.2 $
  **
  **  History file routines.
  */
***************
*** 9,21 ****
  #include "innd.h"
  #include "dbz.h"
  
  
  STATIC char	HIShistpath[] = _PATH_HISTORY;
  STATIC FILE	*HISwritefp;
  STATIC int	HISreadfd;
  STATIC int	HISdirty;
  STATIC int	HISincore = INND_DBZINCORE;
! 
  
  /*
  **  Set up the history files.
--- 9,31 ----
  #include "innd.h"
  #include "dbz.h"
  
+ #define HISCACHESIZE	(64 * 1024L)	/* num. elements in cache array */
+ #define HISCACHELOGTIME	1400L		/* seconds between cache hit reports to syslog */
+ 
+ typedef struct {
+     long		MessageIDHash;
+     BOOL		Found;
+ } _HIScache;
  
  STATIC char		HIShistpath[] = _PATH_HISTORY;
  STATIC FILE		*HISwritefp;
  STATIC int		HISreadfd;
  STATIC int		HISdirty;
  STATIC int		HISincore = INND_DBZINCORE;
! STATIC _HIScache	HIScache[HISCACHESIZE];
! STATIC unsigned long	HIScachehits;
! STATIC unsigned long	HIScachelookups;
! STATIC time_t		HIScachelastreported;
  
  /*
  **  Set up the history files.
***************
*** 46,51 ****
--- 56,67 ----
  	    exit(1);
  	}
      }
+ 
+     syslog(L_NOTICE, "SERVER history cache reset: %ld entries, %u bytes",
+     	   HISCACHESIZE, sizeof(HIScache));
+     memset((void *)&HIScache, 0, sizeof(HIScache));
+     HIScachehits = HIScachelookups = 0;
+     HIScachelastreported = Now.time;
  }
  
  
***************
*** 84,89 ****
--- 100,108 ----
  	    syslog(L_ERROR, "%s cant close history %m", LogName);
  	HISreadfd = -1;
      }
+ 
+   syslog(L_NOTICE, "SERVER history cache final: %lu lookups, %lu hits",
+   	 HIScachelookups, HIScachehits);
  }
  
  
***************
*** 198,206 ****
--- 217,246 ----
  {
      datum	key;
      datum	val;
+     long	hash_pos, hash_val;
+ 
+     hash_val = dbzhash(MessageID, strlen(MessageID));
+     hash_pos = hash_val % HISCACHESIZE;
+ 
+     HIScachelookups++;
+     if (HIScache[hash_pos].MessageIDHash == hash_val) {
+ 	  HIScachehits++;
+ 
+ 	  if (Now.time > (HIScachelastreported + HISCACHELOGTIME)) {
+ 	    syslog(L_NOTICE, "SERVER history cache: %lu lookups, %lu hits",
+ 	  	   HIScachelookups, HIScachehits);
+ 
+ 	    HIScachelastreported = Now.time;
+ 	  }
+ 
+     	  return HIScache[hash_pos].Found;
+     }
  
      HISsetkey(MessageID, &key);
      val = dbzfetch(key);
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = (char)(val.dptr != NULL);  
      return val.dptr != NULL;
  }
  
***************
*** 237,247 ****
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset;
      datum		key;
      datum		val;
      int			i;
  
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
--- 277,288 ----
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset, hash_val, hash_pos;
      datum		key;
      datum		val;
      int			i;
  
+ 
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
***************
*** 279,284 ****
--- 320,332 ----
  	return FALSE;
      }
  
+     /* store hashed message id value in lookup cache */
+     hash_val = dbzhash(Data->MessageID, strlen(Data->MessageID));
+     hash_pos = hash_val % HISCACHESIZE;
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = TRUE;
+     
      if (++HISdirty >= ICD_SYNC_COUNT)
  	HISsync();
      return TRUE;
*** ../inn-plain/dbz/dbz.c	Tue Dec 17 09:40:40 1996
--- dbz/dbz.c	Mon Jun  2 05:24:59 1997
***************
*** 355,361 ****
  extern void CloseOnExec();
  
  /* misc. forwards */
- static long hash();
  static void crcinit();
  static char *cipoint();
  static char *mapcase();
--- 355,360 ----
***************
*** 1426,1432 ****
  {
  	register long h;
  
! 	h = hash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
--- 1425,1431 ----
  {
  	register long h;
  
! 	h = dbzhash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
***************
*** 1716,1725 ****
  }
  
  /*
!  - hash - Honeyman's nice hashing function
   */
! static long
! hash(name, size)
  register char *name;
  register int size;
  {
--- 1715,1724 ----
  }
  
  /*
!  - dbzhash - Honeyman's nice hashing function
   */
! long
! dbzhash(name, size)
  register char *name;
  register int size;
  {
*** ../inn-plain/dbz/dbz.h	Tue Dec 17 09:40:40 1996
--- dbz/dbz.h	Mon Jun  2 05:24:59 1997
***************
*** 24,29 ****
--- 24,30 ----
  extern int dbzcancel();
  extern int dbzdebug();
  extern int dbzwritethrough();
+ extern long dbzhash();
  
  /*
   * In principle we could handle unlimited-length keys by operating a chunk

--------------29E5AA957A2579D2DECFDBB--


Re: INN-1.5.1 dying
#18146
Author: Gary Palmer
Date: Mon, 02 Jun 1997 00:00
31 lines
1599 bytes
In article <5mtdlr$ndu$1@hammer.msfc.nasa.gov>,
J. Porter Clark <jpc@technologist.com> wrote:
>I've had innd core dumps with Clayton O'Neill's patch to do history
>caching--or at least I think that's what it does.  I haven't had time
>to investigate it, though; I just backed it out and all was well.  This
>was on Solaris 2.5.1.

I tested the patch on my box (FreeBSD 2.2.x) and innd crapped out every
couple of hours. I tracked it down to an unitialized variable used during
the processing of cancel messages.

My fix is enclosed (I hope). Clayton also has this patch now as his
box crapped out after a while too :-)

Gary

--- cc.c~	Thu Mar 18 16:04:22 1993
+++ cc.c	Mon Apr 14 01:29:57 1997
@@ -360,7 +360,9 @@
     ARTDATA	Data;
     STRING	p;
 
+    memset(&Data, 0, sizeof(Data));
     Data.Posted = Now.time;
+    Data.Arrived = Now.time;
     Data.Expires = 0;
     Data.Feedsite = "?";
     if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)

Re: INN-1.5.1 dying
#18150
Author: coneill
Date: Mon, 02 Jun 1997 00:00
22 lines
1517 bytes
Jeff Garzik <jeff.garzik@spinne.com> writes:

> It models itself after Clayton O'Neill's patch, but stores hash values
> instead of copying the msg id string each time.  It also adds cache
> stats and logging of said stats, and some warnings to debug the history
> cache code.
> 
> It still crashes...
> +     hash_val = dbzhash(Data->MessageID, Data->MessageIDLength);

This line is probably the problem.  MessageIDLength is not always valid.
You need to replace Data->MessageIDLength with strlen(Data->MessageID).

IMHO the real solution to this problem is to switch to md5 for the hash
function and store the hash in the dbz data file.  Then just mmap the 
.pag file.  Everyone should have enough memory to keep a copy of the
.pag file in memory.  I'm planning on doing this work when I finish 
stablizing my patches wrt to 1.5.1.


Re: INN-1.5.1 dying
#18152
Author: J. Porter Clark
Date: Mon, 02 Jun 1997 00:00
25 lines
1480 bytes
dave.nospam.maam@mathworks.com (Dave Pascoe) writes:

>I just installed INN-1.5.1 a few days ago with many of the patches
>from unoff-patches.  Once or twice a day for the last few days innd
>has been dying mysteriously.  The logs haven't been too revealing.
>I'm still trying to trace down why it's dying.

>Has anyone else had this problem with 1.5.1+patches on a Solaris 2.5
>box?  I doubt that it's Solaris-related, but thought I'd mention it
>anyway.

>Now I'm wishing I stayed at 1.4unoff4+patches....if I can't find and
>fix the 1.5.1 problem, it's back to 1.4 for me.

I've had innd core dumps with Clayton O'Neill's patch to do history
caching--or at least I think that's what it does.  I haven't had time
to investigate it, though; I just backed it out and all was well.  This
was on Solaris 2.5.1.

-- 
J. Porter Clark    jpc@drum.msfc.nasa.gov
NASA/MSFC Flight Data Systems Branch

Re: INN-1.5.1 dying
#18157
Author: Jeff Garzik
Date: Mon, 02 Jun 1997 00:00
27 lines
1607 bytes
J. Porter Clark wrote:
> dave.nospam.maam@mathworks.com (Dave Pascoe) writes:
> >I just installed INN-1.5.1 a few days ago with many of the patches
> >from unoff-patches.  Once or twice a day for the last few days innd
> >has been dying mysteriously.  The logs haven't been too revealing.
> >I'm still trying to trace down why it's dying.

> I've had innd core dumps with Clayton O'Neill's patch to do history
> caching--or at least I think that's what it does.  I haven't had time
> to investigate it, though; I just backed it out and all was well.  This
> was on Solaris 2.5.1.


Ditto here.  It's a very simple patch, and I wasn't immediately able to
see what was wrong with it either.

I even added a speed-up/fix so that the history cache stored the hash
id, not the msg id.  That eliminates any possible malloc problems,
because that eliminated all allocation in the patch, but it still didn't
solve the crashing problems.
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

Re: INN-1.5.1 dying
#18160
Author: Forrest J. Cavalier III
Date: Mon, 02 Jun 1997 00:00
37 lines
1980 bytes
In article <5mt7et$s52$1@turing.mathworks.com>, dave.nospam.maam@mathworks.com 
wrote...
>
>I just installed INN-1.5.1 a few days ago with many of the patches
>from unoff-patches.  Once or twice a day for the last few days innd
>has been dying mysteriously.  The logs haven't been too revealing.
>I'm still trying to trace down why it's dying.
>
>Has anyone else had this problem with 1.5.1+patches on a Solaris 2.5
>box?  I doubt that it's Solaris-related, but thought I'd mention it
>anyway.
>
>Now I'm wishing I stayed at 1.4unoff4+patches....if I can't find and
>fix the 1.5.1 problem, it's back to 1.4 for me.
>

If you have REMEMBER_TRASH DO, then there is a null-pointer patch
you need to apply.  Read a summary at:
    http://www.mibsoftware.com/userkt/inn/patches/0002.htm
----------------------------------------------------------------------
Also, I have become aware of unexplained crashes (with dumped
core) of INN over the last several days.  In the cases I
looked at, there is a seg fault inside the system memory allocation
routines, which must mean the block info was overwritten.  I
didn't try hand checking all the block info, so I can't say what
got trashed or why.

I don't know the root cause, but it appears that there were
some invalid history entries in at least one of the cases.

Anyone else had innd failures recently?

Forrest Cavalier, Mib Software, INN customization and consulting


Re: INN-1.5.1 dying
#18161
Author: Barry BOFHwsma
Date: Mon, 02 Jun 1997 00:00
33 lines
2114 bytes
On Mon, 2 Jun 1997, Jeff Garzik wrote:

> J. Porter Clark wrote:
> > dave.nospam.maam@mathworks.com (Dave Pascoe) writes:
> > >I just installed INN-1.5.1 a few days ago with many of the patches
> > >from unoff-patches.  Once or twice a day for the last few days innd
> > >has been dying mysteriously.  The logs haven't been too revealing.
> > >I'm still trying to trace down why it's dying.
> 
> > I've had innd core dumps with Clayton O'Neill's patch to do history
> > caching--or at least I think that's what it does.  I haven't had time
> > to investigate it, though; I just backed it out and all was well.  This
> > was on Solaris 2.5.1.
> 
> Ditto here.  It's a very simple patch, and I wasn't immediately able to
> see what was wrong with it either.

    I beg to differ.  I've been running with Clayton's patch (thanks
heaps, Clayton, it's been working great for me here) on all three of my
servers (two with 1.4unoff4, one with what still happens to be 1.5b2,
which should destroy all my attempts at credibility here), and I haven't
been seeing any crashes with them, save for once where the problem was
obvious (oops).  All the machines are running SGI IRIX 6.2, not Solaris,
and I haven't really installed many other patches in spite of my
configuration.


Lazy Barry Bouwsma, Radio Praha newsadmin
Mendel University, Brno, CZ


Re: INN-1.5.1 dying
#18167
Author: Sang-yong Suh
Date: Mon, 02 Jun 1997 00:00
13 lines
982 bytes
In article <5mt7et$s52$1@turing.mathworks.com>,
Dave Pascoe <dave.nospam.maam@mathworks.com> wrote:
>Now I'm wishing I stayed at 1.4unoff4+patches....if I can't find and
>fix the 1.5.1 problem, it's back to 1.4 for me.

I have already reverted back to 1.4unoff4.
One SS-1000 Solaris-2.5.1 and two P6-200 Linux-2.0.30 boxes.
And all problems disappeared!
--
sysuh

Re: INN-1.5.1 dying
#18168
Author: Marcus Needham
Date: Mon, 02 Jun 1997 00:00
37 lines
2399 bytes
In article <Pine.GSO.3.93.970602181626.17272C-100000@dahlia.vszbr.cz>, ag786@yfn.ysu.edu wrote:
>On Mon, 2 Jun 1997, Jeff Garzik wrote:
>
>> J. Porter Clark wrote:
>> > dave.nospam.maam@mathworks.com (Dave Pascoe) writes:
>> > >I just installed INN-1.5.1 a few days ago with many of the patches
>> > >from unoff-patches.  Once or twice a day for the last few days innd
>> > >has been dying mysteriously.  The logs haven't been too revealing.
>> > >I'm still trying to trace down why it's dying.
>> 
>> > I've had innd core dumps with Clayton O'Neill's patch to do history
>> > caching--or at least I think that's what it does.  I haven't had time
>> > to investigate it, though; I just backed it out and all was well.  This
>> > was on Solaris 2.5.1.
>> 
>> Ditto here.  It's a very simple patch, and I wasn't immediately able to
>> see what was wrong with it either.
>
>    I beg to differ.  I've been running with Clayton's patch (thanks
>heaps, Clayton, it's been working great for me here) on all three of my
>servers (two with 1.4unoff4, one with what still happens to be 1.5b2,
>which should destroy all my attempts at credibility here), and I haven't
>been seeing any crashes with them, save for once where the problem was
>obvious (oops).  All the machines are running SGI IRIX 6.2, not Solaris,
>and I haven't really installed many other patches in spite of my
>configuration.

I also have used the history-cache patch without a problem than 
I can specifically trace to it.  I do however have a problem with INN
exiting apparently when it receives a message larger then MAX_ART_SIZE.


/// Marcus Needham /// marcus@theriver.com
\\\ VP & Webmaster \\\ The River, Tucson AZ USA, http://www.theriver.com/

Re: INN-1.5.1 dying
#18173
Author: Steinar Haug
Date: Tue, 03 Jun 1997 00:00
20 lines
1465 bytes
[Michael Hucka]

|   But now I'm really wondering whether the rest of you have noticed innd
|   growing in memory consumption like this.  If you have, that may be a reason
|   for the mysterious deaths.  If you haven't, and innd seems to remain at a
|   stable memory size for you, then it must be I've introduced a memory leak
|   somewhere.

Just a small status report here: Running 1.5.1 on a Solaris 2.5.1/NetApp
combination. Three patches applied: Matt Dillon's mmap shared active
patch, the null pointer patch for art.c, and the xref-slave patch.

The system is extremely stable. We've never had a crash of innd, and it
shows no sign of any memory leak. We've literally had innd running for
months at a time.

Steinar Haug, Nethelp consulting, sthaug@nethelp.no

Re: INN-1.5.1 dying
#18185
Author: Barry BOFHwsma
Date: Tue, 03 Jun 1997 00:00
52 lines
3361 bytes
On 3 Jun 1997, Michael Hucka wrote:

> But now I'm really wondering whether the rest of you have noticed innd
> growing in memory consumption like this.  If you have, that may be a reason
> for the mysterious deaths.  If you haven't, and innd seems to remain at a
> stable memory size for you, then it must be I've introduced a memory leak
> somewhere.

    I've had innd grow in size, specifically on the one of my servers
running the cyclical filesystem which handles almost all of my incoming
feeds (but it's not the one you feed, Mike).  I attribute this to the
buffering INN does, since I'm running innfeed on this server but as a
channel feed, and not a funnel file.

    My server is slightly I/O-bound as well as being memory-short, as it
is configured with a single SCSI 4G disk handling everything news-related
-- spool, history files, and logs, plus innfeed backlog tapes.  This disk
ranges from 20% to 60% busy typically.  The server has only 128M of RAM,
and the history file has bloated in size so that now, even after reducing
my remember time to 9 days, it still exceeds 300M in size (and I MMAP
everything I can, as well as cache recent history entries).  Furthermore,
it's primarily a graphics workstation by day, and its news duty can be
considered an afterthought, so that other people are readily able to rob
resources needed by INN.

    When I notice that this server's innd is substantially larger than it
should be, I'll throttle it and let the buffered data for innfeed drain.
There will be times it takes a few minutes for it to finish writing to the
.output files.  Then I can stop and restart INN safely.  If I stop innd
too soon after throttling it, I can easily lose a few megabytes of data
written to an innfeed! file.

    How are you running innfeed?  I'm pretty sure J Porter Clark is still
running it as a channel feed, and this may be another common factor,
perhaps.  Or it's an idea, at least...  The older version of innfeed that
I'm still running is decidedly not as fast as the 0.10 versions, and there
are times when it's the major contender for the CPU.

    There are a handful of improvements that it's becoming clear I need to
make to this machine to enable it to handle the ever-increasing volume of
news (more than 475 000 articles yesterday) as well as the increasing
number of incoming peers it suffers (more than 4 million history lookups
with almost 150 incoming connection at the moment).  I'm running short of
disk space for the history file.


Barry Bouwsma, generic news admin
MZLU, Brno, Czech Republic


Re: INN-1.5.1 dying
#18194
Author: Michael Hucka
Date: Tue, 03 Jun 1997 00:00
34 lines
2408 bytes
I've been running with the O'Neill hashing patch as well (+ other patches, on
Solaris 2.5.1), and have been experiencing similar mysterious innd deaths.
I'm not convinced, however, that these particular innd crashes are caused by
the problem reported by Gary Palmer <gpalmer@SPAM.webspan.net>.  That bug may
exist, but the pattern of crashes seems to point to a different problem and I
wonder if others among you are not experiencing it too.  The pattern that I'm
seeing is that innd keeps growing and growing in memory usage after it's
started, over a period of 2-4 days.  I've seen innd's memory image go to 385+
MB.  Every time I've seen it get that large, I found it dead shortly
afterwards, which leads me to suspect it's simply exhausting swap space and
getting terminated by the OS.

I've visually inspected the O'Neill patch and can't find a memory leak, and
the other patches are similarly small and benign-looking (though it's not
impossible that one of those patches short-circuits some code and causes
a memory leak).

I've tried backing out the O'Neill patch without any change in this behavior,
which is surprising given J. Porter Clark's report that backing out the patch
in his case stopped innd crashing.

But now I'm really wondering whether the rest of you have noticed innd
growing in memory consumption like this.  If you have, that may be a reason
for the mysterious deaths.  If you haven't, and innd seems to remain at a
stable memory size for you, then it must be I've introduced a memory leak
somewhere.

-- 
Mike Hucka    hucka@umich.edu    http://www.eecs.umich.edu/~hucka    University
 PhD to be, computational models of human visual processing (AI Lab)     of
   UNIX systems administrator & programmer/analyst (EECS DCO)         Michigan

Re: INN-1.5.1 dying
#18195
Author: J. Porter Clark
Date: Tue, 03 Jun 1997 00:00
34 lines
2065 bytes
Michael Hucka <hucka@eecs.umich.edu> writes:

>I've tried backing out the O'Neill patch without any change in this behavior,
>which is surprising given J. Porter Clark's report that backing out the patch
>in his case stopped innd crashing.

Again, I haven't had a lot of experience with the O'Neill patch.  I had
been running INN-1.5.1 (with the apb patches among others) for weeks,
and with no problems.  I added the O'Neill patch and had a core dump
overnight.  Tried again the next day and had a core dump within a few
hours.  Backed it out, all was well again.

Yesterday, I added the memset() line, put the O'Neill patch back in,
and haven't had a core dump yet.  I hope that I'll have time to play
with any cores that I get.  (I'll also try Jeff Garzik's patch instead
later.)

>But now I'm really wondering whether the rest of you have noticed innd
>growing in memory consumption like this.  If you have, that may be a reason
>for the mysterious deaths.  If you haven't, and innd seems to remain at a
>stable memory size for you, then it must be I've introduced a memory leak
>somewhere.

I seem to get some slow memory growth, maybe 1 MB/day.  I know I'm
being terribly imprecise, but I attribute this to perl filtering.  If I
recompile without the perl filtering, I get no noticeable long-term
growth.

-- 
J. Porter Clark    jpc@drum.msfc.nasa.gov
NASA/MSFC Flight Data Systems Branch

Re: INN-1.5.1 dying
#18197
Author: Marcus Needham
Date: Tue, 03 Jun 1997 00:00
20 lines
1494 bytes
In article <33937D39.26498660@spinne.com>, Jeff Garzik <jeff.garzik@spinne.com> wrote:
>Marcus Needham wrote:
>> I do however have a problem with INN
>> exiting apparently when it receives a message larger then MAX_ART_SIZE.
>
>
>What version are you running?  1.5.1 appears to work when MAX_ART_SIZE
>and LOCAL_MAX_ARTSIZE are the same (1000000 on this test system):

I applied the fix to cc.c for a uninitialized variable (that tripped up 
history-cache) that was posted earlier today and I think it has resolved the 
problem.  It seems that when the huge article rejection code generated
the internal cancel it tripped the bug every time.


/// Marcus Needham /// marcus@theriver.com
\\\ VP & Webmaster \\\ The River, Tucson AZ USA, http://www.theriver.com/

Re: INN-1.5.1 dying
#18199
Author: Jerry Aguirre
Date: Tue, 03 Jun 1997 00:00
64 lines
2773 bytes
In article <Pine.GSO.3.93.970603154534.6913A-100000@dahlia.vszbr.cz>,
Barry BOFHwsma  <ag786@yfn.ysu.edu> wrote:
>    When I notice that this server's innd is substantially larger than it
>should be, I'll throttle it and let the buffered data for innfeed drain.
>There will be times it takes a few minutes for it to finish writing to the
>.output files.  Then I can stop and restart INN safely.  If I stop innd
>too soon after throttling it, I can easily lose a few megabytes of data
>written to an innfeed! file.

I wonder if this could be the same problem that overchan has.  Innd only
does a write once per service loop.  With enough incomming feeds the
data can exceed what the OS will allow for a single write to a pipe.
Only part of the data gets written each time and so the backlog grows
and grows.   Overchan was the first to get hit because it has the most
data written per article.

The fix is to write after each article rather than once a service loop.
The pipe is buffered and non-blocking so it will not block innd.  You
might try this patch.  It should also reduce transmission latency.

				Jerry Aguirre

*** innd/site.c.orig	Tue Dec 17 06:40:40 1996
--- innd/site.c	Thu Feb 20 10:35:49 1997
***************
*** 260,267 ****
      if (i < sp->StopWriting)
  	WCHANremove(cp);
      if ((sp->StartWriting == 0 || i > sp->StartWriting)
!      && !CHANsleeping(cp))
! 	WCHANadd(cp);
  
      cp->LastActive = Now.time;
  
--- 260,284 ----
      if (i < sp->StopWriting)
  	WCHANremove(cp);
      if ((sp->StartWriting == 0 || i > sp->StartWriting)
!      && !CHANsleeping(cp)) {
! 	if (sp->Type == FTchannel) {	/* channel feed, try the write */
! 	    int j;
! 	    if (bp->Left == 0)
! 		return;
! 	    j = write(cp->fd, (POINTER)&bp->Data[bp->Used], (SIZE_T)bp->Left);
! 	    if (j > 0) {
! 		bp->Left -= j;
! 		bp->Used += j;
! 		i = cp->Out.Left;
! 	    }
! 	    if (bp->Left <= 0)
! 		WCHANremove(cp);
! 	    else
! 		WCHANadd(cp);
! 	}
! 	else
! 	    WCHANadd(cp);
!     }
  
      cp->LastActive = Now.time;
  


INN Performance Patch
#18219
Author: Jeff Garzik
Date: Tue, 03 Jun 1997 00:00
472 lines
13017 bytes
This is a multi-part message in MIME format.

--------------626D7E96693D3FE26F39FE98
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This patch adds *two* caches to INN 1.5.1.  It adds a pre-commit L1
cache, since they're all the rage, and it adds a history cache modeled
after coneill's history hash patch.  Both caches are very effective.  On
my system, I almost always have over a 30% hit rate:

	History cache: 643191 lookups, 318521 hits
	Precommit cache: 606713 lookups, 188485 hits

The L1 precommit cache simply stores hashed msg ids in a 4096-elem array
after an IHAVE or TAKETHIS.  The next IHAVEs or CHECKs that search for
the msg id will be refused.

The L2 history cache functions like coneill's -- it hashes each history
lookup into a large (64 * 1024) array to cache the value of the lookup
for later calls.

The main ways this differs from coneill's patch is
	- is uses NO memory allocation, hash values are stored
	  instead of strdup'ing the msg ids.  After a short test
	  (2-3 hours) storing the msg ids as well as hashes, I found
	  no collisions with duplicate hash values for different
	  msg ids.

	- it fixes the Data->MessageIDLength bug in coneill's patch,
	  and patches cc.c to initialize Data->* fields correctly.

	- reports history and precommit cache hits in syslog and
	  with 'ctlinnd mode'

There is always room for improvement.  MD5 hashes of the msg id (instead
of dbzhash()) would be less prone to possible collisions.

The precommit cache shouldn't be referenced in his.c, but it was
convenient to report precommit cache stats at the same time as reporting
the history cache stats.

Rejected articles might be refused erroneously by the pre-commit cache
with REMEMBER_TRASH is DONT.   Not a big deal IMHO.
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

--------------626D7E96693D3FE26F39FE98
Content-Type: text/plain; charset=us-ascii; name="innd.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="innd.patch"

diff --context -r --ignore-space-change ../inn-plain/innd/cc.c innd/cc.c
*** ../inn-plain/innd/cc.c	Tue Dec 17 09:40:40 1996
--- innd/cc.c	Tue Jun  3 02:49:26 1997
***************
*** 410,420 ****
      ARTDATA	Data;
      STRING	p;
  
!     Data.Posted = Now.time;
      Data.Expires = 0;
      Data.Feedsite = "?";
      if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)
  	return p;
      if (Mode == OMrunning)
  	ARTcancel(&Data, Data.MessageID, TRUE);
      else {
--- 410,422 ----
      ARTDATA	Data;
      STRING	p;
  
!     memset ((void *)&Data, 0, sizeof(Data));
!     Data.Posted = Data.Arrived = Now.time;
      Data.Expires = 0;
      Data.Feedsite = "?";
      if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)
  	return p;
+     Data.MessageIDLength = strlen(Data.MessageID);
      if (Mode == OMrunning)
  	ARTcancel(&Data, Data.MessageID, TRUE);
      else {
***************
*** 734,739 ****
--- 736,747 ----
  }
  
  
+ extern unsigned long           HIScachehits;
+ extern unsigned long           HIScachelookups;
+ extern unsigned long           NCprecomhits;
+ extern unsigned long           NCprecomlookups;
+ 
+ 
  /*
  **  Return our operating mode.
  */
***************
*** 840,845 ****
--- 848,861 ----
          p += strlen(strcpy(p, "disabled"));
  #endif /* defined(DO_PERL) */
  
+     *p++ = '\n';
+     sprintf(p, "History cache: %lu lookups, %lu hits", HIScachelookups, HIScachehits);
+     p += strlen(p);
+ 
+     *p++ = '\n';
+     sprintf(p, "Precommit cache: %lu lookups, %lu hits", NCprecomlookups, NCprecomhits);
+     p += strlen(p);
+ 
       i = strlen(buff);
      if (CCreply.Size <= i) {
  	CCreply.Size = i;
diff --context -r --ignore-space-change ../inn-plain/innd/his.c innd/his.c
*** ../inn-plain/innd/his.c	Tue Dec 17 09:40:40 1996
--- innd/his.c	Tue Jun  3 02:57:40 1997
***************
*** 1,4 ****
! /*  $Revision: 1.23 $
  **
  **  History file routines.
  */
--- 1,4 ----
! /*  $Revision: 1.2 $
  **
  **  History file routines.
  */
***************
*** 9,21 ****
--- 9,33 ----
  #include "innd.h"
  #include "dbz.h"
  
+ #define HISCACHESIZE	(64 * 1024L)	/* num. elements in cache array */
+ #define HISCACHELOGTIME	1400L		/* seconds between cache hit reports to syslog */
+ 
+ typedef struct {
+     long		MessageIDHash;
+     BOOL		Found;
+ } _HIScache;
  
  STATIC char		HIShistpath[] = _PATH_HISTORY;
  STATIC FILE		*HISwritefp;
  STATIC int		HISreadfd;
  STATIC int		HISdirty;
  STATIC int		HISincore = INND_DBZINCORE;
+ STATIC _HIScache	HIScache[HISCACHESIZE];
+ unsigned long		HIScachehits;
+ unsigned long		HIScachelookups;
+ STATIC time_t		HIScachelastreported;
  
+ void NCprecomclear();
  
  /*
  **  Set up the history files.
***************
*** 46,51 ****
--- 58,71 ----
  	    exit(1);
  	}
      }
+ 
+     syslog(L_NOTICE, "SERVER history cache reset: %ld entries, %u bytes",
+     	   HISCACHESIZE, sizeof(HIScache));
+     memset((void *)&HIScache, 0, sizeof(HIScache));
+     HIScachehits = HIScachelookups = 0;
+     HIScachelastreported = Now.time;
+ 
+     NCprecomclear();
  }
  
  
***************
*** 65,76 ****
--- 85,101 ----
  }
  
  
+ extern unsigned long NCprecomhits;
+ extern unsigned long NCprecomlookups;
+ 
  /*
  **  Close the history files.
  */
  void
  HISclose()
  {
+   unsigned long i, holes = 0;
+ 
      if (HISwritefp != NULL) {
  	/* Since dbmclose calls dbzsync we could replace this line with
  	 * "HISdirty = 0;".  Oh well, it keeps the abstraction clean. */
***************
*** 84,89 ****
--- 109,124 ----
  	    syslog(L_ERROR, "%s cant close history %m", LogName);
  	HISreadfd = -1;
      }
+ 
+   for (i = 0; i < HISCACHESIZE; i++)
+     if (HIScache[i].MessageIDHash == 0)
+       holes++;
+ 
+   syslog(L_NOTICE, "SERVER history cache final: %lu lookups, %lu hits, %lu unused slots",
+   	 HIScachelookups, HIScachehits, holes);
+ 
+   syslog(L_NOTICE, "SERVER precommit cache final: %lu lookups, %lu hits",
+   	 NCprecomlookups, NCprecomhits);
  }
  
  
***************
*** 198,206 ****
--- 233,262 ----
  {
      datum	key;
      datum	val;
+     long	hash_pos, hash_val;
+ 
+     hash_val = dbzhash(MessageID, strlen(MessageID));
+     hash_pos = hash_val % HISCACHESIZE;
+ 
+     HIScachelookups++;
+     if (HIScache[hash_pos].MessageIDHash == hash_val) {
+ 	  HIScachehits++;
+ 
+ 	  if (Now.time > (HIScachelastreported + HISCACHELOGTIME)) {
+ 	    syslog(L_NOTICE, "SERVER history cache: %lu lookups, %lu hits",
+ 	  	   HIScachelookups, HIScachehits);
+ 
+ 	    HIScachelastreported = Now.time;
+ 	  }
+ 
+     	  return HIScache[hash_pos].Found;
+     }
  
      HISsetkey(MessageID, &key);
      val = dbzfetch(key);
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = (char)(val.dptr != NULL);  
      return val.dptr != NULL;
  }
  
***************
*** 237,247 ****
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset;
      datum		key;
      datum		val;
      int			i;
  
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
--- 293,304 ----
      char		*paths;
  {
      static char		NOPATHS[] = "";
!     long		offset, hash_val, hash_pos;
      datum		key;
      datum		val;
      int			i;
  
+ 
      HISsetkey(Data->MessageID, &key);
      if (paths != NULL && paths[0] != '\0')
  	HISslashify(paths);
***************
*** 279,284 ****
--- 336,348 ----
  	return FALSE;
      }
  
+     /* store hashed message id value in lookup cache */
+     hash_val = dbzhash(Data->MessageID, strlen(Data->MessageID));
+     hash_pos = hash_val % HISCACHESIZE;
+ 
+     HIScache[hash_pos].MessageIDHash = hash_val;
+     HIScache[hash_pos].Found = TRUE;
+     
      if (++HISdirty >= ICD_SYNC_COUNT)
  	HISsync();
      return TRUE;
diff --context -r --ignore-space-change ../inn-plain/innd/nc.c innd/nc.c
*** ../inn-plain/innd/nc.c	Tue Dec 17 09:40:40 1996
--- innd/nc.c	Tue Jun  3 02:45:58 1997
***************
*** 105,110 ****
--- 105,131 ----
  
  
  /*
+  * precommit cache
+  */
+ #define NCPRECOMCACHESIZE 4096L
+ 
+ STATIC long NCprecomcache[NCPRECOMCACHESIZE];
+ unsigned long NCprecomhits;
+ unsigned long NCprecomlookups;
+ long NCprecompos, NCprecomval;
+ 
+ 
+ void
+ NCprecomclear ()
+ {
+   memset((void *)&NCprecomcache, 0, sizeof(NCprecomcache));
+   NCprecomhits = NCprecomlookups = 0;
+ }
+ 
+ 
+ 
+   
+ /*
  **  Clear the work-in-progress entry and wake up anyone who might
  **  have been waiting for us.
  */
***************
*** 582,588 ****
      if (NCbadid(cp, p))
  	return;
  
!     if (HIShavearticle(p)) {
  	cp->Refused++;
  	NCwritetext(cp, NNTP_HAVEIT);
      }
--- 603,619 ----
      if (NCbadid(cp, p))
  	return;
  
!     NCprecomval = dbzhash(p, strlen(p));
!     NCprecompos = NCprecomval % NCPRECOMCACHESIZE;
!     NCprecomlookups++;
! 
!     if (NCprecomcache[NCprecompos] == NCprecomval) {
! 	NCprecomhits++;
! 	cp->Refused++;
! 	NCwritetext(cp, NNTP_HAVEIT);
!     }
! 
!     else if (HIShavearticle(p)) {
  	cp->Refused++;
  	NCwritetext(cp, NNTP_HAVEIT);
      }
***************
*** 599,604 ****
--- 630,637 ----
  #endif	/* defined(NNTP_RESENDIT_LATER) */
      }
      else {
+ 	NCprecomcache[NCprecompos] = NCprecomval;
+ 
  	NCwritetext(cp, NNTP_SENDIT);
  	cp->State = CSgetarticle;
      }
***************
*** 1486,1492 ****
  	return;
      }
  
!     if (HIShavearticle(p)) {
  	cp->Refused++;
  	(void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_GOTID_VAL, p);
  	NCwritereply(cp, cp->Sendid.Data);
--- 1519,1534 ----
  	return;
      }
  
!     NCprecomval = dbzhash(p, strlen(p));
!     NCprecompos = NCprecomval % NCPRECOMCACHESIZE;
!     NCprecomlookups++;
! 
!     if (NCprecomcache[NCprecompos] == NCprecomval) {
!         NCprecomhits++;
! 	cp->Refused++;
! 	(void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_GOTID_VAL, p);
! 	NCwritereply(cp, cp->Sendid.Data);
!     } else if (HIShavearticle(p)) {
  	cp->Refused++;
  	(void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_GOTID_VAL, p);
  	NCwritereply(cp, cp->Sendid.Data);
***************
*** 1521,1526 ****
--- 1563,1575 ----
      if (!ARTidok(p)) {
  	syslog(L_NOTICE, "%s bad_messageid %s", CHANname(cp), MaxLength(p, p));
      }
+ 
+     else {
+       NCprecomval = dbzhash(p, strlen(p));
+       NCprecompos = NCprecomval % NCPRECOMCACHESIZE;
+       NCprecomcache[NCprecompos] = NCprecomval;
+     }
+ 
      msglen = strlen(p) + 5; /* 3 digits + space + id + null */
      if (cp->Sendid.Size < msglen) {
  	if (cp->Sendid.Size > 0) DISPOSE(cp->Sendid.Data);
*** ../inn-plain/dbz/dbz.c	Tue Dec 17 09:40:40 1996
--- dbz/dbz.c	Mon Jun  2 05:24:59 1997
***************
*** 355,361 ****
  extern void CloseOnExec();
  
  /* misc. forwards */
- static long hash();
  static void crcinit();
  static char *cipoint();
  static char *mapcase();
--- 355,360 ----
***************
*** 1426,1432 ****
  {
  	register long h;
  
! 	h = hash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
--- 1425,1431 ----
  {
  	register long h;
  
! 	h = dbzhash(kp->dptr, kp->dsize);
  	if (osp != FRESH && osp->hash == h) {
  		if (sp != osp)
  			*sp = *osp;
***************
*** 1716,1725 ****
  }
  
  /*
!  - hash - Honeyman's nice hashing function
   */
! static long
! hash(name, size)
  register char *name;
  register int size;
  {
--- 1715,1724 ----
  }
  
  /*
!  - dbzhash - Honeyman's nice hashing function
   */
! long
! dbzhash(name, size)
  register char *name;
  register int size;
  {
*** ../inn-plain/dbz/dbz.h	Tue Dec 17 09:40:40 1996
--- dbz/dbz.h	Mon Jun  2 05:24:59 1997
***************
*** 24,29 ****
--- 24,30 ----
  extern int dbzcancel();
  extern int dbzdebug();
  extern int dbzwritethrough();
+ extern long dbzhash();
  
  /*
   * In principle we could handle unlimited-length keys by operating a chunk

--------------626D7E96693D3FE26F39FE98--


Re: INN Performance Patch
#18224
Author: Matt Dillon
Date: Wed, 04 Jun 1997 00:00
153 lines
8979 bytes
:In article <Pine.BSF.3.96.970604101700.4250A-100000@super-xenu.radio.cz>,
:Ugly Boy  <ag786@yfn.ysu.edu> wrote:
:>On Wed, 4 Jun 1997, Jeff Garzik wrote:
:>
:>Hmmmm, optimizations to err on the safe side, perhaps (or pessimizations
:>depending on how you look at it):
:>
:>> The logic is like this:
:>> 
:>> IHAVE
:>>     if (pre-committed)
:>> 	Refuse
:>
:>At this point and below, instead of refusing it (since the transfer is not
:>yet complete and there is a very slight danger you won't get the article),
:>you could return the Defer (431/436) code, to force the other peer to try
:>again.  The situation could arise where all but one of your peers has the
:>article with winternet in the path, and that one peer from which you would
:>accept the article offers it at the time one of the other sites has caused
:>the message-ID to be in your pre-commit cache.

    Deferal responses do not work.  In fact, they cause a stable degenerate
    case to occur that can blow a news server up.  The problem is that
    when you return a deferral code, you have no idea what the client on the
    other end is going to do.  Most clients will *RETRY* the article over
    and over again until they get a refusal or are told to send it.

    In a multiple-feed situation, this can and will result in a bunch of
    fast feeds getting 'stuck' behind a slow feed that has gotten a precommit
    lock on a message-id that all the fast feeds want to send.  The slow
    feed will often be able to complete processing and precommit the next
    message-id before the fast feeds can 'move on' to the next message-id,
    causing a backup to occur.  The entire news system is reduced to the 
    speed of the slowest feed.

    No high speed news transit system worth its salt will even contemplate
    returning a deferral, which means the only responses available are 
    basically 'I have it already' or 'send it to me'.


:>Granted, it's highly unlikely, but you're always taking a risk if you
:>refuse an article before it's completely transferred.  I usually see a
:>couple dozen or so articles which somehow get mangled in transit each day
:>and thus need to be transferred a second time for success.  And we all
:>know what happens when part 175 of a multi-part post is missing.

    If you have multiple feeds, this is not usually an issue.  If you have
    two feeds, and want to guarentee 2-way redunancy for connection failures,
    get two feeds that are out of sync with each other.  Also, if you do
    not acknowledege the article you gave the go ahead for, and the connection
    dies, then the feed that you gave the go ahead to will resend the article
    anyway after it reestablishes the connection.  So, really, it is not an 
    issue.

    In fact, in a two-feed situation, you WANT to get two feeds that are
    out of sync with each other if only to handle the case where your machine
    crashes.

:>This is another window of vulnerability when an article can be duplicated,
:>when several peers have given you the CHECKs simultaneously, you've
:>responded affirmatively to them, since nobody has actually gotten around
:>to the low-latency IHAVE or reached the point of beginning the transfer
:>with the TAKETHIS.
:>
:>Depending on the number of CHECKs the peers are giving you and the latency
:>and bandwidth between you and size of articles to be transferred, there

    The whole point of a precommit cache is to avoid this situation.
    It isn't a precommit cache if it doesn't pre-commit :-) The first 
    check for a message-id locks that message-id.  Checks coming from 
    other feeds get an immediate 'I have it arleady' response.  However,
    you do bring the point:

:>Just how one would treat a situation like this is dependent on your
:>concern and/or greed.  If your biggest worry is how much fame, wealth, and
:>fortune you will receive in exponential proportion to your status in the
:>top 1000, you want to take the article from whoever gets it to you first,
:>so you probably would dispense with refusing or deferring articles based
:>on the promise that they're on their way.  Then, if you want to absolutely
:>minimize the amount of bandwidth wasted by multiple transfers of the same
:>article, you're going to want to add it to the pre-commit cache as soon as
:>the first peer mentions it to you, even though it would be possible for
:>another peer to offer a CHECK and receive a Roger and get the article to
:>you before your first peer clears out previously acknowledged articles and
:>finally gets around to the TAKETHIS.

     Yes, absolutely.  However, the people that actually try to implement
     the 'take it from everyone who offers it' approach have a number of
     hurdles to pass.  The problem is, again, a STABLE degenerate case
     in the algorithm whereby all the incoming feeds offer the article
     at the same time and are told to send it.  If you have 50 incoming
     feeds, you have 50x the incoming bandwidth that you would have otherwise.
     And this is a *STABLE* degenerate case... the feeds will tend to stay
     IN SYNC.  Once the machine gets locked into it, your incoming bandwidth
     will explode and probably take the machine with it.

     There are a few ways around this... you can allow two locks on the
     precommit cache rather then one, so two different feeds are given the
     go ahead while the others are told to skip the message.  This way the
     degenerate case is only 2x the incoming bandwidth that would otherwise
     be required.  Since a newsfeed is around 50 KBytes/sec 24 hours a day,
     even the 2x degenerate case can blow up some poor sod's T1 :-)

     I don't think it's worth it, and Diablo doesn't do it.  Diablo (1.09)
     uses a precommit cache that locks on the ihave/check command and has
     a 30 second timeout.  There are no degenerate cases, which means it
     will remain stable under all sorts of adverse conditions.  The 
     possibility of loosing an article due to a precommit collision is
     basically zero.  Sure, you will not necessarily receive any given
     article the quickest possible way, but Diablo doesn't cater to that
     crowd.  In my eyes, a 50 mS lag in receiving an article is just fine
     if it means the news transit system is guarenteed to be stable.

:>Another thing to note, for sites such as myself with multiple news
:>servers, is that pre-commit caches are spiffy when all feeds point to a
:>single, sometimes overburdened machine.  But when a site chooses to split
:>incoming feeds among multiple machines for redundancy, and particularly
:>when these machines are not perfectly synchronized, two or more sites can
:>easily be sending the same articles at the same times as there's no way
:>for the two servers getting the article to know that it's already coming
:>in to the other.  I see ten or so thousand duplicated articles this way
:>with just two supplementary feeds to my secondary server, which is less
:>than 5% of incoming articles, but possibly a significant volume if many of
:>these are large binaries.  I could reduce this by asking those two sites
:>to aim at my overworked incoming server, and then have only the slowest
:>sites feed the other machine as backup.

    I think this is a necessary evil.  I have about 20 full feeds, 10 of
    which are mostly synchronized with each other, and 5 of which are 
    synchronized within 50 mS of each other, and I kid you not!  Maxwell 
    has feeds that are synchronized within a few milliseconds of each other.
    It's pretty insane.

    If I were to split my incoming feeds across two machines, my incoming
    bandwidth would plain and simply double no matter what I did.

:>> Almost mind-numbingly simple.  :)
:>
:>Yeah, and I twist it into this overly-long drivel.  Ah, well, I've written
:>enough for this time of day, with the clarity of what I write proportional
:>and the quantity inversely proportional to the hour of the day.
:>
:>Barry Bouwsma   http://www.netscum.net/bouwsmb0.html
:>news.radio.cz admin in scenic sorta sunny Brno, Czechia

    Heh.

						-Matt



Re: INN Performance Patch
#18225
Author: Matt Dillon
Date: Wed, 04 Jun 1997 00:00
61 lines
3524 bytes
:In article <3395099D.1A6AB61@spinne.com>,
:Jeff Garzik  <jeff.garzik@spinne.com> wrote:
:>Ugly Boy wrote:
:>>     I have to wonder about this -- while it certainly is of benefit to
:>> refuse following references to an article which is in the process of
:>> being offered (are CHECKs included as well as IHAVE or TAKETHIS?) where
:>> bandwidth is concerned, there always remains the possibility that a
:>>...
:>Certainly, that is the danger of all precommit caches.  However,
:>presumeably the relatively small size of the precommit cache will mean
:>that by the time the article is offered again, seconds or minutes or
:>hours later by another peer, the hash will have been overwritten,
:>...
:>
:>Being connected to so many fast sites means that I'm very likely to get
:>an article offered to me multiple times simultaneously.  From looking at
:>the code, INN appears to accept the transfer of all articles, and flag
:>the ones that arrive later as "trash" so the later articles are
:>...
:>A better solution would be to timeout each precommit after 30 seconds
:>(like Diablo), rather than wait until the hash is overwritten, but I
:>went for simple rather than complete.  (Or slack rather than complete. 
:>:))

    The precommit stuff I implemented in Diablo works really, really well.
    It doesn't catch everything, but it catches enough.  I think you
    should definitely put in a timeout, though... it's real easy to 
    do.   Just store the current time in the cache record.  When you
    go to lookup something in the cache, and find a valid record,
    check the current time against the time in the cache record.
    If the difference is more then +/- the cache timeout (30 seconds
    in the case of diablo), you just act as though a cache-miss
    occured.  (you have to check for negative deltas in case the
    system's time-of-day gets adjusted backwards).

    The precommit cache is designed to fill the window inbetween the
    ihave/check for the message-id and the actual commit of the message-id
    to the history file after the article is completely received, so
    the cache entries need only last long enough to cover that short
    period of time.  Once an article is commited to history, the
    history file lookups take care of longer-term duplication.

    While there is a small chance that the precommit will scrap a
    potentially valid push and allow one that 'fails' in the middle
    of the transfer, the same article will almost certainly be
    offered at a later time by another feed, so the precommit is,
    in fact, very robust.

:>Almost mind-numbingly simple.  :)
:>-- 
:>Jeff Garzik
:>News Administrator, Spinne, Inc.
:>http://www.spinne.com/usenet/

    Yah, simple algorithms are always the best algorithms.

						-Matt


Re: INN Performance Patch
#18241
Author: J. Porter Clark
Date: Wed, 04 Jun 1997 00:00
18 lines
1265 bytes
Jeff Garzik <jeff.garzik@spinne.com> writes:

>This patch adds *two* caches to INN 1.5.1.  It adds a pre-commit L1
>cache, since they're all the rage, and it adds a history cache modeled
>after coneill's history hash patch.  Both caches are very effective.  On
>my system, I almost always have over a 30% hit rate:

FWIW, this patch seems to be unappliable [1] to an
INN-1.5.1 with the apb patch(es).

[1] Is that a word?  "Inapplicable" seems wrong to me.

-- 
J. Porter Clark    jpc@drum.msfc.nasa.gov
NASA/MSFC Flight Data Systems Branch

Re: INN Performance Patch
#18245
Author: Jeff Garzik
Date: Wed, 04 Jun 1997 00:00
55 lines
2587 bytes
Ugly Boy wrote:
>     I have to wonder about this -- while it certainly is of benefit to
> refuse following references to an article which is in the process of
> being offered (are CHECKs included as well as IHAVE or TAKETHIS?) where
> bandwidth is concerned, there always remains the possibility that a
> transfer will fail for any of a number of reasons.


Certainly, that is the danger of all precommit caches.  However,
presumeably the relatively small size of the precommit cache will mean
that by the time the article is offered again, seconds or minutes or
hours later by another peer, the hash will have been overwritten,
allowing the article to be attempted again without worry about refusal
by the precommit cache.

Being connected to so many fast sites means that I'm very likely to get
an article offered to me multiple times simultaneously.  From looking at
the code, INN appears to accept the transfer of all articles, and flag
the ones that arrive later as "trash" so the later articles are
ignored.  I wanted something that *wouldn't* have five sites sending me
the same article at the same time.

A better solution would be to timeout each precommit after 30 seconds
(like Diablo), rather than wait until the hash is overwritten, but I
went for simple rather than complete.  (Or slack rather than complete. 
:))

The logic is like this:

IHAVE
    if (pre-committed)
	Refuse
    otherwise (check history, etc.)
    otherwise
	We don't have the article,
	Mark article in pre-commit cache
	go to 'get article' state

CHECK
    if (pre-committed)
	Refuse
    otherwise (check history, etc.)

TAKETHIS
    Mark article in pre-commit cache


Almost mind-numbingly simple.  :)
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

Re: INN Performance Patch
#18247
Author: Ugly Boy
Date: Wed, 04 Jun 1997 00:00
40 lines
2444 bytes
On Tue, 3 Jun 1997, Jeff Garzik wrote:

> This patch adds *two* caches to INN 1.5.1.  It adds a pre-commit L1
> cache, since they're all the rage
>
> 	Precommit cache: 606713 lookups, 188485 hits
> 
> The L1 precommit cache simply stores hashed msg ids in a 4096-elem array
> after an IHAVE or TAKETHIS.  The next IHAVEs or CHECKs that search for
> the msg id will be refused.

    I have to wonder about this -- while it certainly is of benefit to
refuse following references to an article which is in the process of
being offered (are CHECKs included as well as IHAVE or TAKETHIS?) where
bandwidth is concerned, there always remains the possibility that a
transfer will fail for any of a number of reasons.

    INN will tell the other side to try again later if an article is in
transit, and this is quite effective, as in my daily news reports I see I
spool a good number of articles for later offering, with an increased
number of spoolings for larger articles, for peers which normally keep up
without problems -- even to the point where many more articles are
deferred than actually accepted+refused+rejected.

    I personally would play it safe and give a 431/436 code to the other
peers offering the same article, so it will be refused later after the
transfer actually is successful.  Otherwise you run the risk of missing an
article entirely if all your peers offer it simultaneously and the one
which actually is chosen for the honors drops the ball.

    On the other hand, you make the sending site do a bit of extra work
spooling the article, unspooling it, and offering it again...  Life sucks.

Just a thought...
Barry Bouwsma, Radio Praha newsadmin
MZLU Brno CZ


Re: INN Performance Patch
#18249
Author: Ugly Boy
Date: Wed, 04 Jun 1997 00:00
124 lines
7096 bytes
On Wed, 4 Jun 1997, Jeff Garzik wrote:

Hmmmm, optimizations to err on the safe side, perhaps (or pessimizations
depending on how you look at it):

> The logic is like this:
> 
> IHAVE
>     if (pre-committed)
> 	Refuse

At this point and below, instead of refusing it (since the transfer is not
yet complete and there is a very slight danger you won't get the article),
you could return the Defer (431/436) code, to force the other peer to try
again.  The situation could arise where all but one of your peers has the
article with winternet in the path, and that one peer from which you would
accept the article offers it at the time one of the other sites has caused
the message-ID to be in your pre-commit cache.

Granted, it's highly unlikely, but you're always taking a risk if you
refuse an article before it's completely transferred.  I usually see a
couple dozen or so articles which somehow get mangled in transit each day
and thus need to be transferred a second time for success.  And we all
know what happens when part 175 of a multi-part post is missing.


>     otherwise (check history, etc.)
>     otherwise
> 	We don't have the article,
> 	Mark article in pre-commit cache
> 	go to 'get article' state
> 
> CHECK
>     if (pre-committed)
> 	Refuse
>     otherwise (check history, etc.)

This is another window of vulnerability when an article can be duplicated,
when several peers have given you the CHECKs simultaneously, you've
responded affirmatively to them, since nobody has actually gotten around
to the low-latency IHAVE or reached the point of beginning the transfer
with the TAKETHIS.

Depending on the number of CHECKs the peers are giving you and the latency
and bandwidth between you and size of articles to be transferred, there
can easily be several seconds or more from the time the first CHECK is
given, until one of the peers actually starts the transfer and effectively
locks it out for any further peers offering it.  This is one of the
bandwidth-wasting drawbacks of streaming when one has multiple peers,
particularly when they are well-synchronized and thus getting affirmative
responses to their CHECKs within a second or two of each other.  As noted
earlier in this newsgroup, while non-streaming connections to INN and
TAKETHIS commands are able to cause these messages to be locked out or
deferred from delivery by other peers, no comparable optimization has been
made for streaming connections.  As I've noted, a greater number of CHECKs
makes things worse by increasing the delay from ACK to transfer, so more
connections with fewer CHECKs at a time is one way to reduce the number of
rejected articles from multiple peers. 

Just how one would treat a situation like this is dependent on your
concern and/or greed.  If your biggest worry is how much fame, wealth, and
fortune you will receive in exponential proportion to your status in the
top 1000, you want to take the article from whoever gets it to you first,
so you probably would dispense with refusing or deferring articles based
on the promise that they're on their way.  Then, if you want to absolutely
minimize the amount of bandwidth wasted by multiple transfers of the same
article, you're going to want to add it to the pre-commit cache as soon as
the first peer mentions it to you, even though it would be possible for
another peer to offer a CHECK and receive a Roger and get the article to
you before your first peer clears out previously acknowledged articles and
finally gets around to the TAKETHIS.

And this is where a further bandwidth optimization can take place, where
the first mention of an article loads it into the pre-commit cache, where
it remains until timing-out/cycling-out, and again is refreshed when the
TAKETHIS is reached.  Again, I'd really rather give a 431/436 Try again in
a sec' response rather than a 438 Negatory, Good Buddy, simply because for
any  number of reasons, an article which is CHECKed can disappear or
otherwise not be transferred successfully.  Remember, a CHECK is even  
more like saying that the CHECK, er, I mean, the check is in the mail.

Such an optimization would result in a drastic reduction of most of the
remaining wasted bandwidth of duplicates, with only a slight increase in
the number of CHECKs having to be given multiple times if deferred.  The
drawback would be a possible delay of up to a few minutes in the arrival
time of some articles later than when they would arrive if other peers
wasted bandwidth by sending them as well.


> TAKETHIS
>     Mark article in pre-commit cache

This is the point at which INN by default returns its 431/436 Wait jes' a
minute thar response to additional CHECKs/IHAVEs, based on observing the
responses to innxmit, and the statistics given by innfeed.  I didn't write
or study the code, so I'm not one to speak authoritatively on this.

Another thing to note, for sites such as myself with multiple news
servers, is that pre-commit caches are spiffy when all feeds point to a
single, sometimes overburdened machine.  But when a site chooses to split
incoming feeds among multiple machines for redundancy, and particularly
when these machines are not perfectly synchronized, two or more sites can
easily be sending the same articles at the same times as there's no way
for the two servers getting the article to know that it's already coming
in to the other.  I see ten or so thousand duplicated articles this way
with just two supplementary feeds to my secondary server, which is less
than 5% of incoming articles, but possibly a significant volume if many of
these are large binaries.  I could reduce this by asking those two sites
to aim at my overworked incoming server, and then have only the slowest
sites feed the other machine as backup.


> Almost mind-numbingly simple.  :)

Yeah, and I twist it into this overly-long drivel.  Ah, well, I've written
enough for this time of day, with the clarity of what I write proportional
and the quantity inversely proportional to the hour of the day.

Barry Bouwsma   http://www.netscum.net/bouwsmb0.html
news.radio.cz admin in scenic sorta sunny Brno, Czechia


Re: INN Performance Patch
#18259
Author: Jeff Garzik
Date: Thu, 05 Jun 1997 00:00
22 lines
1580 bytes
Matt Dillon wrote:
>     Deferal responses do not work.  In fact, they cause a stable degenerate
>     case to occur that can blow a news server up.  The problem is that
>     when you return a deferral code, you have no idea what the client on the
>     other end is going to do.  Most clients will *RETRY* the article over
>     and over again until they get a refusal or are told to send it.


Deferral responses work if the feed has a CHECK backlog of any length,
or has some articles to send.  Feeding file-per-article news systems
like INN almost guarantees a delay of some sort before a msg id
previously sent to "the back of the line" is re-offered for transit.

Feeding systems like Diablo or Cyclone will indeed generate this kind of
bouncing.
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

Re: INN Performance Patch
#18266
Author: Jerry Aguirre
Date: Thu, 05 Jun 1997 00:00
28 lines
2073 bytes
In article <33948068.4F305FB8@spinne.com>,
Jeff Garzik  <jeff.garzik@spinne.com> wrote:
>The L1 precommit cache simply stores hashed msg ids in a 4096-elem array
>after an IHAVE or TAKETHIS.  The next IHAVEs or CHECKs that search for
>the msg id will be refused.

I thought that INN already did this including a 60 second timeout.
As is mentioned later in this thread this leads to the case where
a slow feed can offer an article and all the others that attempt
to send the same article (via IHAVE) will stall waiting for either
the article to be received or the 60 seconds to elapse.

Also for streaming (CHECK/TAKETHIS) the description doesn't seem
correct.  The time to wory about duplicates is when the "CHECK" is
sent, not the TAKETHIS.  When the sender does the "CHECK" you have to
decide if it is a duplicate, being sent via another feed, or something
you want.  If the sender does a TAKETHIS it is too late.  That article
is coming (perhaps already has) down the pipeline.  I.E. if 5 sites all
do a check and you respond that you want them then your going to get
5 copies of the article.

Fortunately streaming mode has a working send this later function.  Innxmit
will try a few seconds later a couple of times and then requeue to disk
for the next run.  It would be very reasonable to lock the ID at the first
check and return a "send it later" code to any other CHECK for that ID.

Re: INN Performance Patch
#18296
Author: Jeff Garzik
Date: Thu, 05 Jun 1997 00:00
34 lines
2189 bytes
Jerry Aguirre wrote:
> I thought that INN already did this including a 60 second timeout.
> As is mentioned later in this thread this leads to the case where
> a slow feed can offer an article and all the others that attempt
> to send the same article (via IHAVE) will stall waiting for either
> the article to be received or the 60 seconds to elapse.

Very true, but if you refuse the IHAVE the feeds don't stall.  (Can't
really do much else with IHAVE anyway)

> Also for streaming (CHECK/TAKETHIS) the description doesn't seem
> correct.  The time to wory about duplicates is when the "CHECK" is
> sent, not the TAKETHIS.  When the sender does the "CHECK" you have to
> decide if it is a duplicate, being sent via another feed, or something
> you want.  If the sender does a TAKETHIS it is too late.

The reason I pre-commit the TAKETHIS is to make sure no one else offers
this article through CHECK or IHAVE during the transfer.  And for
articles that were previously CHECKed, it refreshes their cache entry so
that the lock has a longer life.

INN's default behavior for IHAVE is to download the article, then scrap
it if the same article arrived before the first copy finished
downloading.  The behavior for CHECK is better -- it defers the
article.   Neither refuse the article (without the pre-commit patch),
which is sometimes the desired behavior in a high-speed or redundant
environment.
-- 
Jeff Garzik
News Administrator, Spinne, Inc.
http://www.spinne.com/usenet/

Re: INN Performance Patch
#18354
Author: bill davidsen
Date: Mon, 09 Jun 1997 00:00
24 lines
1633 bytes
In article <33964CF1.3CA5ACF0@spinne.com>,
Jeff Garzik  <jeff.garzik@spinne.com> wrote:

| The reason I pre-commit the TAKETHIS is to make sure no one else offers
| this article through CHECK or IHAVE during the transfer.  And for
| articles that were previously CHECKed, it refreshes their cache entry so
| that the lock has a longer life.

Here's a thought... when an article is offered and it's in transit,
reject it but keep track of which site offered it. If the transfer
fails, could you simply rejuest it from a site which offered it,
even though you rejected it? Interesting thought, I haven't check
the source code, but it seems that since you include the article
number I suspect that it would work. Of course if the socket dropped
on machine before A finished...

Oh well, a thought. 
--
	-bill davidsen (davidsen@tmr.com)
"As a software development model, Anarchy does not scale well."
		-Dave Welch

Re: INN Performance Patch
#18387
Author: Jerry Aguirre
Date: Tue, 10 Jun 1997 00:00
74 lines
4431 bytes
In article <5nhpsu$189g$1@newssvr06-int.news.prodigy.com>,
bill davidsen <davidsen@tmr.com> wrote:
>Here's a thought... when an article is offered and it's in transit,
>reject it but keep track of which site offered it. If the transfer
>fails, could you simply rejuest it from a site which offered it,
>even though you rejected it? Interesting thought, I haven't check

At least for innxmit this will not work.  The streaming code in innxmit
keeps track of the outstanding message IDs.  It won't let you fake an
"i want that ID" response for some other ID not in the current CHECK or
TAKETHIS list.

There are several other options including option 3 which is one I don't
remember seeing proposed before:

1 Pause the subsequent connections.  This is what innd did for the
  simple "IHAVE" case when more than one was offered.

2 Send a "send it later" code.  Innxmit should retry a couple of times
  (5 currently) during that sesson and then requeue to disk for the next
  run.

3 Keep track of the message ID of the subsequent "CHECK"s but go on
  processing other IDs.  Later, when the article has been
  completely transferred send back an appropriate response to all who
  offered it.  The client that actually transferred the article gets a
  successful response code for that ID.  All the other clents that
  offered that article via "CHECK" get a refusal status for that ID.
  As the return stream is modeless the response can be sent back at any
  time.

  As currently coded innxmit will keep on sending other IDs and
  accept a response on an ID later and out of sequence.  There are
  limits on how far this can be stretched but it should still be
  sufficient for handling simultainious CHECKs.  In particular innxmit
  will keep track of the IDs for which there has been no response.  If
  enough (16-32) other IDs get responses it will retry the
  transmission on the assumption that the server has lost track of it.
  After a few (5) of these it will abort the connection.

  This ability to return responses out of sequence was one of the
  justifications for including the message ID in each response.  It was
  suggested that the client could guess the ID from the sequence of
  responses.  This would have limited the flexability of the client to
  process multiple articles in parallel and return the status on
  completion rather than in sequence.

  So the server could simply postpone responding to a "CHECK" for which
  other "CHECK", "TAKETHIS", or "IHAVE"s had been received.  It would
  process the next ID instead.  Perhaps it could keep the deferred
  IDs in a list associated with that incomming connection.  Some limit
  to how many it could postpone would be desirable to avoid tripping
  innxmit's retransmission counters.

  Even in the case where several feeds offer the exact same
  sequence of articles this would allow the client to avoid duplicates
  and get all the articles reliably.  Client 1 would offer article A
  and be asked to send it.  Client 2 would also offer article A but be
  postponed.  Client 2 would then offer article B and be asked to
  transfer it.  Client 3 would postpone both A and B and transfer
  article C instead.  Eventually article A would be processed from
  server A and acknowledged.  At that time a duplicate refusal would be
  sent to both client 2 and 3 for that ID.  Meanwhile all 3 clients
  would continue to provide useful transfers and divide the load.

  If this doesn't work with some other streaming client then that
  client is broken(TM).  This doesn't address IHAVE connections but I
  don't think anything can.  The old IHAVE protocol is just too limited
  to keep up with current demands.

				Jerry Aguirre

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads