Archived

This forum has been archived. Please start a new discussion on GitHub.

Db::del: DB_RUNRECOVERY: Fatal error, run database recovery

HI bernard:
when I use Freeze Map in my mutlithread environment . it oftern occured the error : DB_RUNRECOVERY: Fatal error, run database recovery, But when I restart my program , it's ok, what's wrong ?

The following is my db environment:

I use 2 connector, one for read (mutlithread) and another for write, how can I avoid this error?

Comments

  • bernard
    bernard Jupiter, FL
    With so little information on your application, it's hard to tell.
    These two Freeze connections, do they share the same Ice communicator? If not, this would be a problem. Next, be careful with connections:

    Connection and map objects are “single threaded”: if you want to use a connection or any of its associated maps from multiple threads, you must serialize access to them. If your application requires concurrent access to the same database file (persistent Map), you must create several connec-tions and associated maps.

    In particular if you use iterators, you are very likely to run into troubles with concurrent non-serialized access to a connection or any of its maps.

    Cheers,
    Bernard
  • HI bernard:
    thanks for your quickly response, I foud the problem. it's that I don't lock freeze map for write and read.

    thanks
  • HI bernard:
    I found another problem, when I read freeze map in one Connection (mutlithread and with high load ), but when write to freeze map in other connection (they are same database file) , the written thread hang up. and after that all ICE has hang up, can't do anything, I think this problem is in Berkeley DB and it has no any exception return. it has occured deadlock.

    my question is : did any Connection want to use lock to lock each other?
  • bernard
    bernard Jupiter, FL
    Freeze configures Berkeley DB with deadlock detection, so if your application creates a database deadlock (with only Berkeley DB locks involved), you'll get an exception.

    If you use iterators, you must be very careful to close them when no longer needed. Otherwise, these iterators will keep database read locks and will "lock out" your writer.

    Cheers,
    Bernard
  • I see, thanks
  • HI bernard:
    I can't find how to close iterator in C++?

    iterator.close() not a function of iterator.
  • bernard
    bernard Jupiter, FL
    In C++, you close an iterator by destroying it or by assigning <map object>.end() to it.

    Cheers,
    Bernard