[odb-users] mysql crash in multithreaded application

Lukas Obermann obermann.lukas at gmail.com
Mon Jun 19 12:54:32 EDT 2017

Ok, this is good then.

One more question on session in in multiple threads.
We are creating a session once on init. Should that also be done per thread?

Allow me to share the class I am talking about.
https://github.com/xbmc/xbmc/blob/feature_odb/xbmc/dbwrappers/CommonDatabase.cpp <https://github.com/xbmc/xbmc/blob/feature_odb/xbmc/dbwrappers/CommonDatabase.cpp>
https://github.com/xbmc/xbmc/blob/feature_odb/xbmc/dbwrappers/CommonDatabase.h <https://github.com/xbmc/xbmc/blob/feature_odb/xbmc/dbwrappers/CommonDatabase.h>

All threads use that class to basically get a transaction and getting the odb::database object (which is also only created once and then shared for all).
Queries are then done like


Can that be the source of our issues?


> Am 19.06.2017 um 18:44 schrieb Boris Kolpackov <boris at codesynthesis.com>:
> Lukas Obermann <obermann.lukas at gmail.com> writes:
>> Is has_current() considering the thread it currently is in? Means
>> can it be used to determine if the current thread has a transaction
>> already?
> Yes, it can *only* be used to determine if the current thread has an
> active transaction (it uses TLS to store the current pointer).
> Boris

More information about the odb-users mailing list