[net.news] mdbm library source, and some DBM problems

wls@astrovax.UUCP (William L. Sebok) (08/14/84)

Anybody feel like making news use this mdbm library rather than the dbm
library?   This package is (as far as I can tell) in the public domain.
It would be very nice to have both rnews/inews and readnews/vnews able
to access both the history and a mail route dbm-style data base, something
this dbm package would allow. I may make this change if I get ambitious.

Anyway lately I've been having lots of mysterious problems with the dbm
routines.  It started happening during a period when I hadn't been fooling
with the news software.  My friends at princeton!uucp started getting lots
of messages from my uuxqt saying that rnews had dumped core with signal
SIGILL.  Sure enough, I traced it to the dbm file consistency check abort().
Also news wasn't getting expired because expire would dump core when it
found the offending block.

I wrote a program using the consistency checking code of dbm that would
dump the offending block of the history.pag file. The form of the error seems
to be a single negative short in an otherwise sorted list of shorts. I also
(out of necessity) wrote a program to rebuilt the dbm files from the history
file.  This happens almost once an evening.  rnews is sufficient in itself to
invoke the problem (out of habit I now often check history.pag and found it
corrupted between checks. Expire only runs at 5 am here). To make sure it
wasn't a failure of the locking mechanism I added 4.2 BSD flock() calls before
and after data base accesses, using exclusive lock mode.  I also added such
flock() calls to expire and my rebuilding program (I noticed that expire has
NO locks when it rebuilds the dbm files.  I consider that a bug).  The problem
kept occuring.

  Finally,  several times I rebuilt both the history and the history dbm
files with the -r option of the new expire. One of these times expire
dumped with a SIGILL signal, again traced to a dbm consistency check failure
on the file it was building.  The uucp log showed that news was quiescent
at this time.  I immediately captured the history file it was using and ran
expire -r again.  This time it completed successfully.  I extracted the
dbm rebuilding code from expire and incorporated it into a program which I ran
several times on the history file that produced the original coredump.  One of
those times it dumped core with SIGILL.

This test seemed to eliminate one likely scenario, that something going wild
in rnews is messing up the dbm routine's variables.

I am beginning to strongly suspect a bug in the dbm routines, perhaps exposed
by the history dbm files growing large.  The history.pag file is now about
252000 bytes.  I am really at my wits end now.  News survives here by
constantly rebuilding the dbm files.  We are very short on cpu cycles here so
I am not very willing to eliminate using the dbm routines entirely (although
I tried that at one time).
-- 
Bill Sebok			Princeton University, Astrophysics
{allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!wls

geoff@utcsstat.UUCP (Geoff Collyer) (08/16/84)

mdbm is *not* in the public domain.  It contains code from the v7 dbm(3)
library and should not have been distributed in net.sources.