shelve, segfault and bsddb.db.DBPageNotFoundError: (-30987,

Discussion in 'Python' started by Gabriel Rossetti, Oct 14, 2009.

  1. Hello everyone, I get the following error with the shelve module (python
    2.5.2) sometimes :

    >>> s = shelve.open("save.dat", writeback=True)
    >>> s

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.5/UserDict.py", line 167, in __repr__
    return repr(dict(self.iteritems()))
    File "/usr/lib/python2.5/UserDict.py", line 105, in iteritems
    for k in self:
    File "/usr/lib/python2.5/UserDict.py", line 92, in __iter__
    for k in self.keys():
    File "/usr/lib/python2.5/shelve.py", line 92, in keys
    return self.dict.keys()
    File "/usr/lib/python2.5/bsddb/__init__.py", line 252, in keys
    return _DeadlockWrap(self.db.keys)
    File "/usr/lib/python2.5/bsddb/dbutils.py", line 62, in DeadlockWrap
    return function(*_args, **_kwargs)
    bsddb.db.DBPageNotFoundError: (-30987, 'DB_PAGE_NOTFOUND: Requested page
    not found')

    This must mean that my file is currupt, correct? If I do the following I
    get a segfault :

    >>> len(s)

    Segmentation fault

    Is this a bug? So as a workaround I must do something like this :

    s = shelve.open("save.dat", writeback=True)
    try:
    s.keys()
    except bsddb.db.DBPageNotFoundError, e:
    os.remove("save.dat")
    s = shelve.open("save.dat", writeback=True)

    Any other ideas/comments? Does anyone else have this problem?

    Thanks,
    Gabriel
    Gabriel Rossetti, Oct 14, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Glenn R Williams
    Replies:
    0
    Views:
    424
    Glenn R Williams
    Aug 14, 2004
  2. Neville C. Dempsey
    Replies:
    0
    Views:
    360
    Neville C. Dempsey
    Jun 12, 2005
  3. Skip Montanaro
    Replies:
    1
    Views:
    385
    Bengt Richter
    Jun 26, 2005
  4. Andrey Vul
    Replies:
    8
    Views:
    673
    Richard Bos
    Jul 30, 2010
  5. DPalao
    Replies:
    0
    Views:
    231
    DPalao
    Feb 16, 2011
Loading...

Share This Page