[odb-users] mysql crash in multithreaded application

Wolfgang Haupt haupt.wolfgang at gmail.com
Fri Jun 16 12:21:06 EDT 2017


Hi,

I use odb 2.4.0 compiled for multidatabase support for mysql and sqlite.
Currently testing with mysql I encounter a crash in my application when 2
threads access the database at the same time.
I have a singleton that holds the odb::database instance and it also has a
getTransaction method to give transactions to threads.
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.

Backtrace:
https://pastebin.com/70aQx741

Thread 1 and Thread 11 are doing a database query at the same time.
The backtrace shows a heap corruption wihtin mysql.

I found following mysql multithreaded information:
https://stackoverflow.com/questions/26936481/multithreaded-programming-with-libmysql
Does odb do this already?
Do I need to create the create the database connection in the main thread
at the very beginning of the application?


Best Regards,
Wolfgang


More information about the odb-users mailing list