[odb-users] ODB Crashed in a multi-threaded environment

Boris Kolpackov boris at codesynthesis.com
Thu Feb 4 04:44:45 EST 2016


Hi Albert,

Albert (Jinku) Gu <albert.gu at ringcentral.com> writes:

> Or, is there any detailed steps/guidelines to say how we can support
> concurrency with ODB?

With SQLite, it boils down to two things:

1. Make sure that you build SQLite with -DSQLITE_ENABLE_UNLOCK_NOTIFY=1

   See, for example, this Android guide:

   http://wiki.codesynthesis.com/Using_ODB_on_Android

   Also, when building libodb-sqlite, watch out for messages at the end
   of the ./configure output -- it warns you if the unlock notification
   is not supported by the SQLite build that you are using.

2. Follow the multi-threading guidelines outlined in the ODB manual.
   Specifically, don't share connections (or worse, transactions)
   between threads. Only share the database and let its connecton pool
   hand out a connecion to each thread.

Also note that SQLite concurrency is generally quite poor, especially
for write-heavy applications.

Boris



More information about the odb-users mailing list