🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #8161

Re: nnmaster keeps getting stuck (and FAQ doesn't help)

#8161
From: Bryan Feir
Date: Wed, 13 Nov 1996 00:00
71 lines
3665 bytes
   I didn't see the first article in this thread, so I'm not sure what
brought this on, but I had a similar problem and fixed it.  Sorry if
this is a 'known' problem, but...

   When we first upgraded to nn 6.5.1, suddenly nnmaster would get stuck
every time we went to do an expire operation.  It would sit for several
hours, then complain finally of a timeout and exit.  Naturally, this
played havoc with the cron jobs that gathered news, as there was a copy
of nnmaster already running.  (We use cron jobs instead of nnmaster's
own daemon mode to have better control of when the program is run as it
hits the network hard, and to limit the newsgroups it requests to those
in somebody's .newsrc file.)

   It seemed that nnmaster was not recognizing the '.' line that signalled
the end of the list of articles in the 'LISTGROUP' command.  So it would
keep reading lines and waiting for the '.' that had already come in, and
eventually time out.

   Further investigation uncovered the root cause...

   A few years ago when we first started using nn 6.4, we had the company's
head newsadmin put the LISTGROUP call into the hub NNTP server.  The code
that was put in was actually in mild violation of the spec: it only ended
lines with \n instead of with \r\n.  This wasn't a problem in 6.4.18, where
the get_server_line() function stripped everything following the first \r
character or the last \n; but it was a problem in 6.5.1, which wouldn't
strip anything unless the line ended with exactly \r\n\0.  The result was
that get_server_line() returned a string of ".\n" to nntp_get_article_list()
instead of ".", and the extra character was enough to cause the comparison
to fail and the client and server to get out of sync in their states.

   The fix was fairly simple, though what I did was probably not the 'most
correct' way of doing it: I just had get_server_line() strip off any \r or
\n characters at the end of the line.  Things have worked since.

*** nntp.c      Mon Oct  7 16:10:20 1996
--- nntp.c.orig Mon Aug 26 00:09:08 1996
***************
*** 250,260 ****
      }
  
      size = strlen(string);
!     while (size > 1 && (string[size-1] == '\n' || string[size-1] == '\r')) {
!         size--;
!         string[size] = '\0';   /* nuke CR/LF or combination */
!     }
!     return size;
  }
  
  /*
--- 250,260 ----
      }
  
      size = strlen(string);
!     if (size < 2 || !(string[size-2] == '\r' && string[size-1] == '\n'))
!       return size;                    /* XXX */
! 
!     string[size-2] = '\0';            /* nuke CRLF */
!     return size-2;
  }
  
  /*

---------------------------+---------------------------------------------------
Bryan Feir           VA3GBF|"A half-truth, like a half-brick, is more forcible
bryan@sgl.ists.ca          | in an argument than a whole one...
jenora@istar.ca            | it carries further."     -- Stephen Leacock
---------------------------+---------------------------------------------------

Technical Details
Message-ID: <bryan.847919962@s2.sgl.ists.ca>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mail
References: <pjl.847390133@shellx> <55vtfn$7rl@samba.rahul.net>

Show Full Headers
Complete Article Headers
Message-ID: <bryan.847919962@s2.sgl.ists.ca>
Subject: Re: nnmaster keeps getting stuck (and FAQ doesn't help)
Date: Wed, 13 Nov 1996 00:00:00 +0000
From: bryan@sgl.ists.ca (Bryan Feir)
References: <pjl.847390133@shellx> <55vtfn$7rl@samba.rahul.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mail
X-Deja-AN: 196309002
Sender: news@newshub.ists.ca
Organization: Institute for Space and Terrestrial Science
Newsgroups: news.software.nn