[odb-users] mysql crash in multithreaded application

Lukas Obermann obermann.lukas at gmail.com
Mon Jun 19 12:37:46 EDT 2017

Hi Boris,

may I ask a question related to this.
So, we are using odb::transaction::has_current() to check if there is an active transaction.
If not, a new one is created. 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?


> Am 19.06.2017 um 18:29 schrieb Boris Kolpackov <boris at codesynthesis.com>:
> Hi Wolfgang,
> Wolfgang Haupt <haupt.wolfgang at gmail.com> writes:
>> I don't use a connection_factory, so I assume every thread get's a new
>> connection and it does not close existing ones, if I got it correct from
>> the docs.
> Right, you are using the connection pool factory by default which will
> recycle the connections. So as long as you don't share connections or
> transactions between threads, it should work.
>> I found following mysql multithreaded information:
>> https://stackoverflow.com/questions/26936481/multithreaded-programming-with-libmysql
>> Does odb do this already?
> Yes, though the way this is done is pretty crazy (thanks to the way MySQL
> does things). See odb/mysql/connection-factory.cxx in libodb-mysql for
> the gory details.
> One thing that you can try is build the 'common/threads' test from the
> odb-tests package. If it works then it is most likely the problem is in
> your application.
> Boris

More information about the odb-users mailing list