[odb-users] Coredump in multithreading environment and one transaction

Javier Gutierrez javier.gutierrez at web.de
Thu Apr 23 10:29:58 EDT 2020

Thanks for the reply.

> My guess (without looking at the stack trace) is that this has to do with
> object image (essentially, buffers) that are used to load objects from
> database representation and are per-connection. In your case they would be
> shared without any protection. One way to fix this would be to iterate
over the
> result under the lock, load all the objects, and return them as a vector
or some
> such.

You mean there might be cases where such objects image would be shared with
protection ? Do you have any examples so I can have a better understanding
of what you mean ?

> Note also that query result caching is to be able to have several query
results at
> the same time in a single transaction.

Yes that was my understanding. But I guess the result catching idea gets
defeated for a single transaction + multiple threads if you have to use the
fix you recommend above.

> Also, for some databases, caching is a
> noop/unsupported. See the Limitations section for your database in the
> for details.

Hmm I need to support all database then I am better off going for your fix.

For completeness here the stack trace:

#0  0x00007fac3914feb2 in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#1  0x00007fac391624dc in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#2  0x00007fac39162613 in SSL_write () from
#3  0x00007fac39767fb7 in vio_ssl_write(Vio*, unsigned char const*, unsigned
long) () from /usr/local/lib/libmysqlclient-21.so
#4  0x00007fac39776d06 in net_write_packet(NET*, unsigned char const*,
unsigned long) () from /usr/local/lib/libmysqlclient-21.so
#5  0x00007fac39776ed3 in net_flush(NET*) () from
#6  0x00007fac39777861 in net_write_command(NET*, unsigned char, unsigned
char const*, unsigned long, unsigned char const*, unsigned long) () from
#7  0x00007fac397767d0 in cli_advanced_command () from
#8  0x00007fac3977f06b in mysql_stmt_prepare () from
#9  0x00007fac3e07da64 in odb::mysql::statement::init(unsigned long,
odb::mysql::statement_kind, odb::mysql::binding const*, bool) ()
   from /usr/local/lib/libodb-mysql-2.5.0-b.17.so
#10 0x00007fac3e07dc1d in
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, odb::mysql::statement_kind,
odb::mysql::binding const*, bool) ()
   from /usr/local/lib/libodb-mysql-2.5.0-b.17.so
#11 0x00007fac3e07e268 in
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, bool, bool, odb::mysql::binding&,
odb::mysql::binding&) ()
   from /usr/local/lib/libodb-mysql-2.5.0-b.17.so
#12 0x00007fac216e8b23 in odb::access::view_traits_impl<stm::TestView,
(odb::database_id)0>::query (q=...)
    at /home/home/user1/dev/build/database/TestView-odb-mysql.cxx:290
#13 0x00007fac216e8d99 in odb::access::view_traits_impl<stm::TestView,
(odb::database_id)0>::query (db=..., q=...)
    at /home/home/user1/dev/build/database/TestView-odb-mysql.cxx:305
#14 0x00007fac2172f785 in odb::access::view_traits_impl<stm::TestView,
(odb::database_id)5>::query (db=..., q=...)
    at /home/home/user1/dev/inc/database/odb/TestView-odb.ixx:28
#15 0x00007fac21732c0d in odb::database::query_<stm::TestView,
(odb::database_id)5, (odb::class_kind)1>::call<odb::query<stm::TestView,
odb::query_base> > (db=..., q=...) at
#16 0x00007fac2173163e in odb::database::query<stm::TestView>
(this=0x55b09dba2240, q=..., cache=true)
    at /usr/local/include/odb/database.txx:19
#17 0x00007fac21730256 in
stm::DbReader<stm::TestView>::getSelectWithCondition (this=0x55b09dc14400,
    std::shared_ptr<stm::OdbTransactionHandler> (use count 2, weak count 0)
= {...}, inQuery=...)
    at /home/user1/dev/inc/DatabaseManager.hpp:362
#18 0x00007fac2172d6ce in
ransactionInfo> const&, std::shared_ptr<stm::InputRecordGroupInfo> const&,
std::shared_ptr<stm::RecordInfo> const&,
std::shared_ptr<stm::OutputRecordGroupInfo> const&) (this=0x55b09dc13f50,
transaction=std::shared_ptr<stm::TransactionInfo> (use count 17, weak count
0) = {...},
    record=std::shared_ptr<stm::RecordInfo> (use count 1, weak count 0) =
    outputRecordGroup=std::shared_ptr<stm::OutputRecordGroupInfo> (use count
16, weak count 0) = {...})
    at /home/user1/dev/src/TestLookupModule.cpp:163

More information about the odb-users mailing list