🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
3 messages
3 total messages Started by Roger Abrahams Fri, 10 Jan 1992 02:01
Re: Problem with Cnews relaynews and bad batches
#1010
Author: Roger Abrahams
Date: Fri, 10 Jan 1992 02:01
59 lines
3984 bytes
In article <1992Jan9.100907.13305@cs.tu-berlin.de> net@cs.tu-berlin.de (Oliver Laumann) writes:
>I'm running Cnews (with all patches until 22-Dec-1991 applied) and
>NNTP 1.5.11 on a Sun-3/260 with SunOS 4.1.1.  NNTP is compiled with
>CNEWS, DBZ, and BACTHED_INPUT.
>
>Every night relaynews leaves a few batches in $NEWSARTS/in.coming/bad.
>Visual inspection of the batches doesn't reveal any obvious damages,
>and I can't find any error messages in $NEWSCTL/log, except for the
>usual ancient/future date and bad header warnings.  $NEWSCTL/errlog is
>empty.  What is relaynews supposed to log when it encounters a bad
>batch and where?
>
>The strange thing is that when I put the bad batches back into
>in.coming, the next newsrun that is fired up by an nntpd processes the
>batches fine, i.e. it doesn't put them into in.coming/bad again.
>
>Where should I start looking for the source of the problem, and what
>exactly makes relaynews regard a batch as `bad'?
>
>Thanks,
>--
>Oliver Laumann    net@tub.cs.tu-berlin.de  net@tub.UUCP  net@tub.BITNET

Now I have exactly the same problem, however, I know my cause.  You might
consider checking cronlog files if you run newsrun out of cron, the error
might show up there.

In my case, I have a smallish AT&T 3b1 Unix-PC box with only 2.5 megs of
active memory and 5 megs of swap.  The kernel configuration is somewhat
on the small size by modern standards also.  Now the real problem for me
is not in c-news but rather in the recently posted trn 2.2.  It seems that
the mthreads program is a real hog of memory and system resources.  In fact
it will grab all the memory it can get (2.5 megs, a built in hardware limitation
as the machine can only physically address 4 megs, so 2.5 is practical with
the kernel, shared memory and basic stuff running).  When mthreads runs as a
daemon, it will eventually abort as it is unable to process all the groups
completely.  It no longer can malloc the memory necessary.  This is on a machine
that receives a moderate sized feed, but nowhere near a full feed.  Even if
it runs after a recent expire, and somehow manages to compete and go to
sleep, it is still grabbing a full meg of memory.

Now, since I can not run this as a daemon (I simply can't spare the memory),
I run it out of cron.  If it happens that relaynews starts up, and there is
a sufficent load of news (I have it set up for immediate processing), 
relaynews will still be running when cron starts mthreads.  Now mthreads
seems to hold onto what ever memory it gets, and relaynews gives it back
(apparently) between batches, so if mthreads is pretty well along and the 
relaynews program starts to unpack a batch, then the system kills the
relaynews program, and the batch is placed in the bad directory, silently,
unless I run it manually, in which case I can see the "killed" error on
the system console.  Other wise, there is NO logging to errlog at all.

This reduces the functionality of trn quite a bit, but I have a problem
seeing this as a flaw in trn, given the current state of machines it
would probably run on.  It's just that this box is getting too small,
a problem I hope to deal with soon, a larger, more modern machine is
the real fix is here.

						- roger@booth.uucp
Re: mthreads problem on a 3b1
#1014
Author: Wayne Davison
Date: Fri, 10 Jan 1992 19:05
17 lines
1591 bytes
Roger Abrahams (roger@booth.uucp) wrote:
> In my case, I have a smallish AT&T 3b1 Unix-PC box with only 2.5 megs of
> active memory and 5 megs of swap.  [...] It seems that
> the mthreads program is a real hog of memory and system resources.  In fact
> it will grab all the memory it can get (2.5 megs [...]

No, mthreads doesn't need anywhere near that much memory.  On our Sun it
typically expands to about 256k (which is what it is right now).  There is
apparently a bug somewhere in the 3b1's compiler, support libraries, or
_something_ that is causing it to waste memory.  I don't have access to a
3b1 (or 3b2, which has the same problem), so I can't check it out.  Also,
none of the people who have these systems have yet been able to tell me
what their system is doing wrong, so I have not been able to provide a fix.
-- 
 \  /| / /|\/ /| /(_)    Wayne Davison
(_)/ |/ /\|/ / |/  \     davison@borland.com
   (W   A  Y   N   e)
Re: mthreads problem on a 3b1
#1026
Author: Rob Stampfli
Date: Sun, 12 Jan 1992 06:18
70 lines
4765 bytes
In article <1992Jan10.190520.22679@borland.com> davison@borland.com (Wayne Davison) writes:
>Roger Abrahams (roger@booth.uucp) wrote:
>> In my case, I have a smallish AT&T 3b1 Unix-PC box with only 2.5 megs of
>> active memory and 5 megs of swap.  [...] It seems that
>> the mthreads program is a real hog of memory and system resources.  In fact
>> it will grab all the memory it can get (2.5 megs [...]
>
>No, mthreads doesn't need anywhere near that much memory.  On our Sun it
>typically expands to about 256k (which is what it is right now).  There is
>apparently a bug somewhere in the 3b1's compiler, support libraries, or
>_something_ that is causing it to waste memory.  I don't have access to a
>3b1 (or 3b2, which has the same problem), so I can't check it out.  Also,
>none of the people who have these systems have yet been able to tell me
>what their system is doing wrong, so I have not been able to provide a fix.

There is something very wrong with mthreads on the 3B1.  It does behave
exactly like Roger says.  I studied it quite intently for awhile -- it
acts like it has a memory leak.  Here is what I found:  When it
is executed, it starts out fairly small, but then continues to consume
memory (at a fairly linear rate) until it hits the 3b1's limit of 2.5 Meg.
It then aborts with a "malloc failure" message.

Is it malloc'ing and not freeing?  Not that I can tell.  I wrote a
special envelope for the malloc/free routines and the safemalloc/safefree
counterparts that keep track of what is done.  I could not detect any
pointers allocated but not freed after extensive runs.  Is it corrupting
memory by writing before/after the malloc'ed space?  I modified the
envelope routines to leave an untouched 4-byte buffer on each side of
any malloc'ed area and that didn't change things one bit.  Is malloc
hosed on the 3B1?  I used both the standard as well as the -lmalloc
options and they behaved identically.  I even played around with
the -lmalloc mallopt() parameters to no avail.  I then wrote a program
which randomly does malloc's and frees (of previously malloc'ed memory) --
_it_ didn't grow without bound.  I also run the KA9Q net program, which was
conceived around the concept of malloc/free, and it has run fine without
this apparent anomaly for years.  I did verify also that the malloc program
really thought it *was* consuming the memory.  It does, and it isn't
something like a recursive function call growing the stack without end.
Oh yes, no difference whether I use cc or gcc (1.39).  And, no difference
whether compiled with the 3B1 shared library or not.  Cores (2.5 Meg ones.)
show reams and reams of the same items that are in the .thread files --
Message-IDs, Subject lines, etc.

I did find what I think are a couple of bugs in mthreads:  There are several
instances of:
	"safefree(article->id);"
which should be
	"safefree(&article->id);"

in mt-read.c.  Changing these did not materially affect the memory leak,
though.  (I tried sending mail to you, Wayne, but it bounced.)

I finally gave up.  I only thread about 150 groups on my machine and this
is not enough to cause mthreads, or the 3B1, undue hardship, provided it
is invoked like Roger says.  It *does* do the intended job, just consuming
an ever increasing quantity of memory in the process.  I would like to run
it as a daemon process, though, eventually.

What I didn't do was verify that something was not calling malloc() with
an increasingly larger argument.  Maybe I will check this if I get time.  
My gut feeling is that either (1) mthreads is doing something cleverly
diabolical that just happens to be benign on other artitectures, or (2)
malloc() and free() have an obscure bug on the 3B1 that mthreads manages
to stimulate.  Whichever, if anyone can shed any light on this, I would
certainly like to hear about it.

Well, at least this is the stuff that makes software engineering interesting...
-- 
Rob Stampfli, 614-864-9377, res@kd8wk.uucp (osu-cis!kd8wk!res), kd8wk@n8jyv.oh
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