This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bsddb keys corruption
Type: Stage:
Components: Extension Modules Versions: Python 2.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, mconley, niemeyer, tzot
Priority: normal Keywords:

Created on 2002-02-26 02:49 by mconley, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (4)
msg9419 - (view) Author: Marc Conley (mconley) Date: 2002-02-26 02:49
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.


msg9420 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2002-09-10 11:42
Logged In: YES 
user_id=539787

What does the following produce as output in the above example?

>>> db[db.keys()[0]]

If that fails, you most surely have key corruption.  If not,
then please come back with a standalone script that displays
erratic behaviour.
msg9421 - (view) Author: Gustavo Niemeyer (niemeyer) * (Python committer) Date: 2002-11-06 18:09
Logged In: YES 
user_id=7887

Marc, could you please provide a testcase, as stated below?  
   
msg9422 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-05-17 00:58
Logged In: YES 
user_id=357491

Well, considering no one has provided a test case to reproduce this in over 
half a year I am closing this bug as invalid.
History
Date User Action Args
2022-04-10 16:05:02adminsetgithub: 36160
2002-02-26 02:49:35mconleycreate