[odb-users] any significant changes to threading model in 2.5?

Boris Kolpackov boris at codesynthesis.com
Tue Feb 18 04:38:57 EST 2025


NIkolai Marchenko <enmarantispam at gmail.com> writes:

> I am getting this error:
> 
>  /home/zeks/odbbuild/libodb-gcc-9/libodb-gcc-9/libodb-2.5.0/odb/transaction.cxx:340:
> virtual odb::connection&
> odb::transaction_impl::connection(odb::transaction_impl::database_type*):
> Assertion `db == 0 || db == &database_' failed.

This is a "sanity check" that makes sure you don't use a transaction that
was started on a different database instance. This check is actually new
in 2.5.0, I see it's not present in 2.4.0. So maybe it is catching an
error on your side?

The only significant threading-related change in ODB 2.5.0 is that we
have switched to C++11 threads. In ODB 2.4.0 we used POSIX threads on
POSIX and Win32 threads on Windows. But I don't think this should matter,
even if you are using the POSIX API for TLS.


> This happens modestly in thread workers, my code is keeping thread_local
> instance of odb::transaction obtained with db->begin().

It would be interesting to see if database_ points to a valid database
instance.



More information about the odb-users mailing list