db->seq never gets to end

"Jeremy C. Reed" <[email protected]>
Newsgroups gmane.os.netbsd.help
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.