Subject: db->seq never gets to end
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 08/09/2007 22:57:39
Hopefully this list is okay ...

I am using:

        for (r = db->seq(db, &dbk, &dbd, R_FIRST); !r;
            r = db->seq(db, &dbk, &dbd, R_NEXT)) {

But sometimes it never ends.

I added a counter. And it would get to hundreds of thousands and data 
would repeat. I only have less than 1500 keys. I'd also get dbd.size that 
would be hundreds of thousands of bytes (but should only be 20 bytes).

Is there any way to ask the hash(3) how many elements it has? Or is the 
way to loop like above and count?

Is there any way to ask what the cursor is? (Is it a number?)

I think something is causing my cursor to reset. But I can't tell yet.

It doesn't happen all the time, but when it does it uses up a ton of 
memory. For now, I "break" if my counter gets too high.

Any suggestions on how to troubleshoot this would be appreciated.

Maybe this is sign of a corrupted database. I am just curious why it 
doesn't happen every time then. I also moved databases out of the way to 
create new ones almost 20 times now and problem continues.

(This is in latest spamd/grey.c code on NetBSD 3.1 on multiple systems.)

  Jeremy C. Reed