🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
10 messages
10 total messages Started by Hugh Messenger Tue, 23 Jan 1996 00:00
nnrpd v. history
#4206
Author: Hugh Messenger
Date: Tue, 23 Jan 1996 00:00
21 lines
1240 bytes
Config:  Alpha, OSF 3.2, INN 1.4

I'm having problems with /usr/local/news growing insanely large,
because of some "persistant" nnrpd's running for days, keeping the
"old" history files open.

Expire runs, mv's history.n to history, but the "old" nnrpd's keep
the "old" history file's inode open.  I have to either kill off the
offending nnrpd's, or reboot the server to free up the space.

This *must* be a known bug, but I can't find anything in the FAQ
about it.

I'm thinking of writing a script to run out of expire after the history
file is built, which kills off running nnrpd's.

Any suggestions?

   -- hugh

Re: nnrpd v. history
#4401
Author: Hugh Messenger
Date: Mon, 29 Jan 1996 00:00
60 lines
2882 bytes
Deeran Peethamparam wrote:
> 
> In article <3105AC38.167E@garply.com>,
>    Hugh Messenger <hippo@garply.com> wrote:
> 
> >Config:  Alpha, OSF 3.2, INN 1.4
> >
> >I'm having problems with /usr/local/news growing insanely large,
> >because of some "persistant" nnrpd's running for days, keeping the
> >"old" history files open.
> 
> AIX 3.2.5, INN 1.4-sec
> 
> Happens here, too.
> 
> Have a cron job which kills old nnrpd's once every morning.  Not the most
> optimal solution, but....  *sigh*

Jerry Aguire mailed me the following scheme, which I'll be experimenting
with "real soon now".  I'll let you know how I get on.

Jerry Sez:

> My mods are buried in a script that does a lot of other things mostly
> related to the local environment.  That script is an argument to news.daily
> so it runs it before running expire.  One of the things it does is to
> create the expire.ctl file based on current disk usage.
> 
> The basic scheme is that before expire runs one does:
> 
>         oh=`ls -i $arch/history.bak | awk '{print $1}'`
>         ch=`ls -i history | awk '{print $1}'`
>         if [ X$ch != X$oh ] ; then
>             cp /dev/null history.bak
>         fi
>         rm -f history.bak
>         ln history history.bak
> 
> The check using "ls -i" is to verify that the history.bak is not
> a hardlink to the working history file.  Wouldn't wan't to truncate
> that.  This could happen if expire has some problem.  In that case
> it would not do the history rename and the .bak link from the previous
> run would still point to history.
> 
> This scheme leaves the history.bak around until the next expire run.
> That way running programs get a grace period, typically 24 hours,
> to continue with the old file.  You don't really need the space until
> expire runs anyway.  At that point the space is freed for expire to
> run with its two copies, history and history.n.
> 
> You can use the same technique to manage history.dir and history.pag.
> The history.pag file can use up enough space to count.
> 
>                                 Jerry

It all looks good in theory.  Lets see if OSF/1 will behave.

   -- hugh

Re: nnrpd v. history
#4409
Author: Deeran Peethamparam
Date: Mon, 29 Jan 1996 00:00
24 lines
1222 bytes
In article <3105AC38.167E@garply.com>,
   Hugh Messenger <hippo@garply.com> wrote:

>Config:  Alpha, OSF 3.2, INN 1.4
>
>I'm having problems with /usr/local/news growing insanely large,
>because of some "persistant" nnrpd's running for days, keeping the
>"old" history files open.

AIX 3.2.5, INN 1.4-sec

Happens here, too.

Have a cron job which kills old nnrpd's once every morning.  Not the most 
optimal solution, but....  *sigh*

Deeran

--
Deeran Peethamparam              \\ PGP key here :
deeranp@singnet.com.sg            \\ http://www.singnet.com.sg/~deeranp
Will administer Unix for chocolate \\

Re: nnrpd v. history
#4425
Author: Hugh Messenger
Date: Tue, 30 Jan 1996 00:00
34 lines
1889 bytes
Dave Barr wrote:
> 
> In article <310D5478.1CFB@garply.com>,
> Hugh Messenger  <hippo@garply.com> wrote:
> >It all looks good in theory.
> 
> Except for the small fact that it's solving a completely different problem.
> 
> A reasonable fix is to add some code to nnrpd:
>         if (I have history file open)
>                 check periodically if (the inode has changed)
>                         close history

The above would be a fine fix if I felt like hacking on nnrpd ... which
I'm not about to do!

Jerry's fix, although not perfect, would seem to work around this
problem without actually touching any INN code.  OK, so you'll always
have two copies of the history file around, but "under control".  And as
it truncates that second history file before running expire, it has the
beneficial side effect of making sure that you always have enough space
on ~news for that second copy but aren't going to need space for three
of the little buggers.

Jerry has never given me bad advice, so I'm going to go with his
suggestion.

If you happen to patch up nnrpd, do let me know :)

> --Dave

   -- hugh

Re: nnrpd v. history
#4454
Author: Dave Barr
Date: Tue, 30 Jan 1996 00:00
34 lines
1626 bytes
[removing bogus Distribution: inet]
In article <310D5478.1CFB@garply.com>,
Hugh Messenger  <hippo@garply.com> wrote:
>Deeran Peethamparam wrote:
>> In article <3105AC38.167E@garply.com>,
>>    Hugh Messenger <hippo@garply.com> wrote:
>> 
>> >Config:  Alpha, OSF 3.2, INN 1.4
>> >
>> >I'm having problems with /usr/local/news growing insanely large,
>> >because of some "persistant" nnrpd's running for days, keeping the
>> >"old" history files open.

>> Have a cron job which kills old nnrpd's once every morning.  Not the most
>> optimal solution, but....  *sigh*
>
>Jerry Aguire mailed me the following scheme, which I'll be experimenting
>with "real soon now".  I'll let you know how I get on.
>
[deleted]
>
>It all looks good in theory.

Except for the small fact that it's solving a completely different problem.


A reasonable fix is to add some code to nnrpd:
	if (I have history file open)
		check periodically if (the inode has changed)
			close history

--Dave

Re: nnrpd v. history
#4472
Author: Jerry Aguirre
Date: Wed, 31 Jan 1996 00:00
38 lines
2484 bytes
In article <4elgf5$60@dodgson.math.psu.edu> barr@math.psu.edu (Dave Barr) writes:
Regarding nnrpds keeping the old history file in use, newslib running out
of disk space, and my script to truncate the history.bak file before
removing it.

>Except for the small fact that it's solving a completely different problem.
>
>
>A reasonable fix is to add some code to nnrpd:
>	if (I have history file open)
>		check periodically if (the inode has changed)
>			close history

Dave, why don't you think that my method solves the problem?

If you "cp /dev/null history.bak" that will, on most Unix versions,
truncate the file to zero length and free all the disk blocks associated
with it.  Even if some other process has the file open you get the disk
blocks back.  The inode may stay busy but I could run a month of those
and not have problems.

Yes, it would be nice if nnrpd had more smarts to notice when the history
file changed.  That would solve 99% of the typical cases.  But this is
not so simple to code?  The typical case has an nnrpd hung waiting on
its incomming connection.  It is not executing so it is a little difficult
for it to decide to do anything about the history file.  Yes you can have
it wake up via an alarm and notice that it needs to do something but it
is very risky to do more than set a flag in such a routine.  So it goes
back to sleep waiting on the read and even though the "close-history"
flag is set it won't do anything about it.

And this ignores the possibility that it is not nnrpd.  Suppose
the other day you were doing "more history" and control-Zed it or left
it running somewhere.  Also nntplink has a mode where it can use the
history file to look up message IDs.  Or someone running a local news
reader, not using NNTP, could also have the history file open.

Re: nnrpd v. history
#4520
Author: Joe Greco
Date: Thu, 01 Feb 1996 00:00
36 lines
2137 bytes
In news.software.nntp article <4ep7lv$dml@dodgson.math.psu.edu>, barr@math.psu.edu (Dave Barr) wrote:
:In article <4eoeeq$c99@olivea.ATC.Olivetti.Com>,
:Jerry Aguirre <jerry@strobe.ATC.Olivetti.Com> wrote:
:>Dave, why don't you think that my method solves the problem?
:
:Hm, it looks like I misread it the first time around.  Yes, if
:you truncate the old history (from the night before) before the
:next expire run that's probably the best method.  However even
:having two copies of the history file around for long periods of
:time is a waste if it doesn't have to.  You could modify this
:technique by periodically checking with something like lsof
:on the history.bak file and truncate the file if no process has
:it open.

But WHY?

Think about it.

In order to rebuild history, you need adequate space to maintain two full
copies of the history file.

Too often I have seen sites where there is "free space" on newslib but not
enough to build a second history.

If you retain the previous history file and zero it right before expire, you
are virtually guaranteed to have space (or run out in a much more obvious
way) because when you do a "df" and you see newslib is always 95% full
you'll get worried.

... Joe

-------------------------------------------------------------------------------
Joe Greco - Systems Administrator			      jgreco@ns.sol.net
Solaria Public Access UNIX - Milwaukee, WI			   414/546-7968

Re: nnrpd v. history
#4535
Author: Hugh Messenger
Date: Thu, 01 Feb 1996 00:00
35 lines
1964 bytes
Dave Barr wrote:
> 
> In article <4eoeeq$c99@olivea.ATC.Olivetti.Com>,
> Jerry Aguirre <jerry@strobe.ATC.Olivetti.Com> wrote:
> >Dave, why don't you think that my method solves the problem?
> 
> Hm, it looks like I misread it the first time around.  Yes, if
> you truncate the old history (from the night before) before the
> next expire run that's probably the best method.  However even
> having two copies of the history file around for long periods of
> time is a waste if it doesn't have to.

I kind of like having that old history around, as it means I'm almost
guarranteed to have enough space on ~news for expire do strut it's
stuff.  In other words, it's space that I'm going to need overnight, so
I think of the history.bak as being a placeholder.

What I don't like is having three or four invisible duplicates, which
Jerry's script takes care of nicely.

BTW, Jerry - sorry about posting your email without asking.  Brain fart.
Mea Culpa.

> You could modify this
> technique by periodically checking with something like lsof
> on the history.bak file and truncate the file if no process has
> it open.

That'd work.

> --Dave

   -- hugh

Re: nnrpd v. history
#4542
Author: Dave Barr
Date: Thu, 01 Feb 1996 00:00
16 lines
1291 bytes
In article <4eoeeq$c99@olivea.ATC.Olivetti.Com>,
Jerry Aguirre <jerry@strobe.ATC.Olivetti.Com> wrote:
>Dave, why don't you think that my method solves the problem?

Hm, it looks like I misread it the first time around.  Yes, if
you truncate the old history (from the night before) before the
next expire run that's probably the best method.  However even
having two copies of the history file around for long periods of
time is a waste if it doesn't have to.  You could modify this
technique by periodically checking with something like lsof
on the history.bak file and truncate the file if no process has
it open.

--Dave

Re: nnrpd v. history
#4557
Author: J. Porter Clark
Date: Fri, 02 Feb 1996 00:00
38 lines
2242 bytes
jerry@strobe.ATC.Olivetti.Com (Jerry Aguirre) writes:

>Yes, it would be nice if nnrpd had more smarts to notice when the history
>file changed.  That would solve 99% of the typical cases.  But this is
>not so simple to code?  The typical case has an nnrpd hung waiting on
>its incomming connection.  It is not executing so it is a little difficult
>for it to decide to do anything about the history file.  Yes you can have
>it wake up via an alarm and notice that it needs to do something but it
>is very risky to do more than set a flag in such a routine.  So it goes
>back to sleep waiting on the read and even though the "close-history"
>flag is set it won't do anything about it.

How about this:

   for each command
     note the time
     if current time is more than 10 minutes since last command
       if history is open
	 close history

At worst, you will have two history files around for almost
CLIENT_TIMEOUT + 10 minutes (typically 2 hours 10 minutes).  But it
involves no signal handling and should be portable.  (I picked 10
minutes out of the air.)

>And this ignores the possibility that it is not nnrpd.  Suppose
>the other day you were doing "more history" and control-Zed it or left
>it running somewhere.  Also nntplink has a mode where it can use the
>history file to look up message IDs.  Or someone running a local news
>reader, not using NNTP, could also have the history file open.

Of course, this doesn't handle these situations.

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

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