[Python-bugs-list] [ python-Bugs-522780 ] bsddb keys corruption

noreply@sourceforge.net noreply@sourceforge.net
Mon, 25 Feb 2002 18:49:35 -0800


Bugs item #522780, was opened at 2002-02-25 18:49
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=522780&group_id=5470

Category: Extension Modules
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Marc Conley (mconley)
Assigned to: Nobody/Anonymous (nobody)
Summary: bsddb keys corruption

Initial Comment:
I'm having a problem with either the keys() function 
returning invalid information or the database getting 
corrupted or something along those lines. This is what 
I keep seeing occasionally during my development:

Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for 
more information.
>>> import bsddb
>>> db = bsddb.hashopen("test.db")
>>> db.keys()
['192.168.0.1799']
>>> db["192.168.0.1799"]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
KeyError: 192.168.0.1799
>>>

The lines of importance are the return value for 
db.keys() and then the traceback. Note that the db.keys
() returns a value that I immediately try to access 
and get a KeyError in so doing.

This happens in a program with multiple threads but 
for which I am using a threading.Lock acquire() and 
release() around all database/bsddb accesses. I am 
also using sync()s after all write operations.

The key value, by the way, should be 192.168.0.179. It 
is consistently, on several different occasions, 
getting the extra "9" appended to the end of it. This 
same problem has occurred 3 times during testing.




----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=522780&group_id=5470