3

I'm having a strange error when assigning certain values to certain keys in my program's dictionary (which is shelved and has approximately 14000 entries currently), a sample output I've pasted at the bottom of this post. Brief example is if I try

dict["-34_45_2_2"] = 1.1 

the error is thrown up immediately at this line, but if I'm using the same key and a different value such as

dict["-34_45_2_2"] = 1.5 

is fine. I've played around with this using different types, values and keys and haven't found any pattern for why these errors are occuring for certain combinations (another example is the value -1.0 is fine but -1.1 throws up the error).

If I try vice-versa, i.e. fixing the value but changing the key, I find a similar thing happen where certain keys result in the error but others (and interestingly, the majority) seem to be okay.

A quick overview of my program is that I'm doing a Monte-Carlo simulation of a bunch of particles and their interactions, the latter is calculated through a numpy integration (and returns a regular python float). The relative positions of the particles is used as the dictionary key (and defined as a string like my 2 examples above), and the interaction as the value (regular python float) associated with it.

Lastly here is an example of the error output:

Traceback (most recent call last):
  File "potts_all_neighbours.py", line 201, in <module>
    sys.relax(Ef, de1,deab_dict, cell_l, cell_r,Temp)
  File "potts_all_neighbours.py", line 77, in relax
    dic["-34_45_2_2"] = 1.1
  File "/usr/lib/python2.7/shelve.py", line 133, in __setitem__
    self.dict[key] = f.getvalue()
  File "/usr/lib/python2.7/bsddb/__init__.py", line 279, in     __setitem__
    _DeadlockWrap(wrapF)  # self.db[key] = value
  File "/usr/lib/python2.7/bsddb/dbutils.py", line 68, in DeadlockWrap
    return function(*_args, **_kwargs)
  File "/usr/lib/python2.7/bsddb/__init__.py", line 278, in wrapF
    self.db[key] = value
bsddb.db.DBRunRecoveryError: (-30973, 'DB_RUNRECOVERY: Fatal error,     run database recovery -- PANIC: Invalid argument')
Exception bsddb.db.DBRunRecoveryError: DBRunRecoveryError(-30973,     'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: fatal region     error detected; run recovery') in  ignored
Exception bsddb.db.DBRunRecoveryError: DBRunRecoveryError(-30973,     'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: fatal region     error detected; run recovery') in  ignored
Josh
  • 321
  • 1
  • 2
  • 6
  • So, clearly you have some kind of error in your database. Have you done as suggested and run a recovery on it? – kindall Mar 19 '15 at 19:26
  • No, I've been googling for an hour about how to do it and still have no clue. Could you point me in the right direction? – Josh Mar 20 '15 at 10:40

1 Answers1

2

I received a similar error. After some debugging, it turned out that (unintentionally) two instances were using the same shelve db file in 'c' mode (R+W +create if absent).

The problem was solved by stopping the two instances and bringing them back up after configuring them to use different shelve db files.

EliadL
  • 6,230
  • 2
  • 26
  • 43