[odb-users] mysql crash in multithreaded application

Boris Kolpackov boris at codesynthesis.com
Mon Jun 19 12:29:52 EDT 2017


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