🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #32387

Re: PII Xeon vs. PII vs. Celeron A for feed boxes and reader boxes?

#32387
From: Matt Dillon
Date: Fri, 23 Oct 1998 00:00
154 lines
5796 bytes
:In article <36311e5e.0@news.sto.telegate.se>,
:Fredrik Lindgren <fredrik@tfi.net> wrote:
:>Matt Dillon <dillon@best.net> wrote in message 70onkf$egp$1@flea.best.net...
:>>:In article <362fa9c5.0@news.sto.telegate.se>,
:>
:>Aha, that is it I guess. There are lots of sockets apparently stuck in the
:>"CLOSE" state. Either that or new ones are showing up faster than they time
:>out. This is unlikely though since the machine will run for about 3-4 days
:>before running our of the 500 slots that are configured. It typically sees
:>100-200 simultaneous readers.
:>
:>The sockets that are stuck are all shown to be in the (startup) phase in
:>dreaderd.status. Some have data en the send-q and some dont.
:>
:>Could this be Linux? I'll try to test it on 2.0.x and see if it works any
:>better.

     Hmmm.   It sounds like a client close of an embrionic connection is 
     not causing the socket to be marked 'readable' in select.  i.e. a bug
     in Linux.  Linux has gone through three rewrites of the tcp stack,
     it could be a select wakeup case that it isn't handling.

     I check for passed descriptors that are beyond select()'s range, so it
     can't be that.  I don't think this sort of thing would occur if the
     box were running out of descriptors, but it would be a good idea to
     double check the max descriptors per process (at least 1024) and
     max descriptors for machine (at least 16384).

     If it is a bug in the linux kernel, we might be able to hack around it by
     scheduling a wakeup that 'marks' all the descriptors readable to force
     a read() attempt every so-often, like every 5 minutes or something.

     I have included a patch below for you to try... see if it clears out the
     stale connections.  This patch is against diablo-1.21-test01.  If this
     patch works, I'll keep it in and extend it to implement an idle timeout
     feature (which dreaderd does not currently have).

:>>:>Anyone else seeing this problem? This is on linux 2.1.113 up to 2.1.125.
:>>:>I guess I ougth to try a 2.0.x series kernel, but I need the new raid
:>>:>support that is in the newer kernels so that I can have up to 12 devices
:>>:>in the spool RAID set.
:>
:>Regards,
:>  Fredrik Lindgren
:>  Sonera Corporation


Index: dreaderd/reader.c
===================================================================
RCS file: /home/ncvs/diablo/dreaderd/reader.c,v
retrieving revision 1.5
diff -c -r1.5 reader.c
*** reader.c	1998/10/22 06:14:23	1.5
--- reader.c	1998/10/24 06:35:10
***************
*** 42,47 ****
--- 42,48 ----
  {
      time_t dtime = 0;
      time_t ltime = 0;
+     time_t itime = 0;
      int counter = 0;
  
      TFd = fd;
***************
*** 90,95 ****
--- 91,102 ----
  	fd_set wfds = WFds;
  	int i;
  
+ 	/*
+ 	 *  Get next scheduled timeout, no more then 2 seconds
+ 	 *  (x 10 counter counts = 20 seconds max for dtime/itime 
+ 	 *  check)
+ 	 */
+ 
  	NextTimeout(&tv, 2 * 1000);
  
  	stprintf("%s readers=%02d spoolsrv=%d/%d postsrv=%d/%d",
***************
*** 115,126 ****
  	if (FeedOnlyServer <= 0) {
  	    if (++counter == 10) {
  		time_t t = CurTime.tv_sec;
! 		if (ltime)
  		    dtime += t - ltime;
  		if (dtime < -5 || dtime >= 60) {
  		    CheckServerConfig(t, ServersTerminated);
  		    dtime = 0;
  		}
  		ltime = t;
  		counter = 0;
  	    }
--- 122,150 ----
  	if (FeedOnlyServer <= 0) {
  	    if (++counter == 10) {
  		time_t t = CurTime.tv_sec;
! 		if (ltime) {
  		    dtime += t - ltime;
+ 		    itime += t - ltime;
+ 		}
+ 
+ 		/*
+ 		 * Check for server config change once a minute
+ 		 */
  		if (dtime < -5 || dtime >= 60) {
  		    CheckServerConfig(t, ServersTerminated);
  		    dtime = 0;
  		}
+ 
+ 		/*
+ 		 * Poll all active descriptors once every 5 minutes.  This
+ 		 * will work around a linux embrionic close bug that
+ 		 * doesn't wakeup select(), and is used to idle-timeout
+ 		 * connections. XXX
+ 		 */
+ 		if (itime < -5 || itime >= 300) {
+ 		    rfds = RFds;
+ 		    itime = 0;
+ 		}
  		ltime = t;
  		counter = 0;
  	    }
***************
*** 220,229 ****
      cmsg.fd = -1;
      errno = 0;
  
-     if (DebugOpt)
- 	printf("RECV MSG\n");
- 
      if ((r = recvmsg(desc->d_Fd, &msg, MSG_EOR|MSG_WAITALL)) == sizeof(dres)) {
  	if (cmsg.fd >= MAXFDS) {
  	    logit(LOG_WARNING, "fd too large %d/%d, increase MAXFDS for select. Closing fd", cmsg.fd, MAXFDS);
  	    /*
--- 244,253 ----
      cmsg.fd = -1;
      errno = 0;
  
      if ((r = recvmsg(desc->d_Fd, &msg, MSG_EOR|MSG_WAITALL)) == sizeof(dres)) {
+ 	if (DebugOpt)
+ 	    printf("RECV MSG\n");
+ 
  	if (cmsg.fd >= MAXFDS) {
  	    logit(LOG_WARNING, "fd too large %d/%d, increase MAXFDS for select. Closing fd", cmsg.fd, MAXFDS);
  	    /*


-- 
    Matthew Dillon  Engineering, HiWay Technologies, Inc. & BEST Internet
                    Communications
    <dillon@best.net> (Please include original email in any response)

Technical Details
Message-ID: <70rsl7$jau$1@flea.best.net>
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: <70j6rm$64j$1@pith.uoregon.edu> <362fa9c5.0@news.sto.telegate.se> <70onkf$egp$1@flea.best.net> <36311e5e.0@news.sto.telegate.se>

Show Full Headers
Complete Article Headers
Message-ID: <70rsl7$jau$1@flea.best.net>
Subject: Re: PII Xeon vs. PII vs. Celeron A for feed boxes and reader boxes?
Date: Fri, 23 Oct 1998 00:00:00 +0000
From: dillon@best.net (Matt Dillon)
References: <70j6rm$64j$1@pith.uoregon.edu> <362fa9c5.0@news.sto.telegate.se> <70onkf$egp$1@flea.best.net> <36311e5e.0@news.sto.telegate.se>
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: 404535623
X-Trace: 909211115 6379 dillon 206.184.139.131
Organization: BEST Internet Communications, Inc. www.best.com
Newsgroups: news.software.nntp