[odb-users] mysql crash in multithreaded application

Wolfgang Haupt haupt.wolfgang at gmail.com
Tue Jun 20 17:07:49 EDT 2017


Hi,

I've been analysing some backtraces too.
What I found is following:

Thread #1:
Thread 1 (Thread 0x7f8dad5a6700 (LWP 2584)):
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f8daf62a55a in __GI_abort () at abort.c:89
#2  0x00007f8daf6664d0 in __libc_message (do_abort=do_abort at entry=2,
fmt=fmt at entry=0x7f8daf755e68 "*** Error in `%s': %s: 0x%s ***\n") at
../sysdeps/posix/libc_fatal.c:175
#3  0x00007f8daf66c956 in malloc_printerr (action=3, str=0x7f8daf752adb
"corrupted double-linked list", ptr=<optimized out>, ar_ptr=<optimized
out>) at malloc.c:5077
#4  0x00007f8daf66ccdc in malloc_consolidate (av=av at entry=0x7f8d9c000020)
at malloc.c:4190
#5  0x00007f8daf66e69a in _int_malloc (av=av at entry=0x7f8d9c000020,
bytes=bytes at entry=3400) at malloc.c:3450
#6  0x00007f8daf670664 in __GI___libc_malloc (bytes=3400) at malloc.c:2890
#7  0x00007f8daff44958 in operator new(unsigned long) () from
/usr/lib/libstdc++.so.6
#8  0x00000000012ba51a in ?? ()
#9  0x00000000012cd844 in
odb::mysql::view_statements<ODBView_TVShow_Seasons>&
odb::mysql::statement_cache::find_view<ODBView_TVShow_Seasons>() ()
#10 0x00000000012c4863 in
odb::access::view_traits_impl<ODBView_TVShow_Seasons,*
(odb::database_id)0*>::query(odb::database&,
odb::mysql::query_base const&) ()
#11 0x00000000012c4abb in
odb::access::view_traits_impl<ODBView_TVShow_Seasons,
*(odb::database_id)0*>::query(odb::database&,
odb::query_base const&) ()
#12 0x0000000000d161b3 in bool
odb::database::query_one_<ODBView_TVShow_Seasons, *(odb::database_id)5*,
odb::query<ODBView_TVShow_Seasons, odb::query_base>
>(odb::query<ODBView_TVShow_Seasons, odb::query_base> const&,
ODBView_TVShow_Seasons&) ()
#13 0x0000000000cdf28c in
CVideoDatabase::GetDetailsForEpisode(odb::result_iterator<ODBView_Episode,
(odb::class_kind)1>, int) ()

Thread #9:
Thread 9 (Thread 0x7f8d91ffc700 (LWP 2596)):
#0  0x00007f8db3e0ff0f in __libc_recv (fd=79, buf=0x7f8d7809f7b0, n=16384,
flags=0) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:28
#1  0x0000000001653240 in vio_read ()
#2  0x00000000016532c4 in vio_read_buff ()
#3  0x00000000016519c3 in ?? ()
#4  0x00000000016666a3 in ?? ()
#5  0x0000000001669b3d in my_net_read ()
#6  0x0000000001671168 in cli_safe_read_with_ok ()
#7  0x0000000001674206 in ?? ()
#8  0x0000000001675d1c in ?? ()
#9  0x0000000001675fc3 in cli_stmt_execute ()
#10 0x0000000001675411 in mysql_stmt_execute ()
#11 0x000000000177ff11 in odb::mysql::select_statement::execute() ()
#12 0x00000000012c9591 in odb::access::object_traits_impl<CODBTVShow,*
(odb::database_id)0*>::artwork_traits::load(std::vector<odb::lazy_shared_ptr<CODBArt>,
std::allocator<odb::lazy_shared_ptr<CODBArt> > >&,
odb::mysql::container_statements<odb::access::object_traits_impl<CODBTVShow,
(odb::database_id)0>::artwork_traits>&) ()
#13 0x00000000012c9bf5 in odb::access::object_traits_impl<CODBTVShow,
*(odb::database_id)0*>::section_foreign_traits::load(odb::access::object_traits_impl<CODBTVShow,
(odb::database_id)0>::extra_statement_cache_type&, CODBTVShow&) ()
#14 0x00000000012c9dd7 in odb::access::object_traits_impl<CODBTVShow,
*(odb::database_id)0*>::load(odb::connection&, CODBTVShow&, odb::section&)
()
#15 0x0000000000cb9d38 in ?? ()
#16 0x0000000000cd8582 in CVideoDatabase::GetArtForItem(int, std::string
const&, std::map<std::string, std::string, std::less<std::string>,
std::allocator<std::pair<std::string const, std::string> > >&) ()
#17 0x0000000000d3ae71 in CVideoThumbLoader::FillLibraryArt(CFileItem&) ()
#18 0x0000000000d3a0a4 in CVideoThumbLoader::LoadItemCached(CFileItem*) ()
#19 0x0000000000d39692 in CVideoThumbLoader::LoadItem(CFileItem*) ()
#20 0x0000000000e05300 in CDirectoryJob::DoWork() ()
#21 0x0000000000d771ce in CJobWorker::Process() ()
#22 0x0000000000dc6a35 in CThread::Action() ()
#23 0x0000000000dc70e1 in CThread::staticThread(void*) ()
#24 0x00007f8db3e06494 in start_thread (arg=0x7f8d91ffc700) at
pthread_create.c:456
#25 0x00007f8daf6dd1bf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:97


What is this database_id?
Does it indicate that Thread 9 is overwriting something in Thread 1?

Thanks for any hints.


Best Regards,
Wolfgang

Boris Kolpackov <boris at codesynthesis.com> schrieb am Di., 20. Juni 2017 um
14:37 Uhr:

> Wolfgang Haupt <haupt.wolfgang at gmail.com> writes:
>
> > "So as long as you don't share connections or transactions between
> > threads, it should work."
> >
> > Does it mean the default mysql factory is not thread safe?
>
> No.
>
>
> > I had a look at the threads sample and you also share the db instance,
> > with your worker tasks.
>
> Yes, the database instance can be shared (as in, accessed simultaneously
> by multiple threads). Connections and transactions that you get from this
> shared database instance cannot.
>
> Boris
>


More information about the odb-users mailing list