← Back to team overview

maria-developers team mailing list archive

Re: lp:~paul-mccullagh/maria/maria-pbxt-rc2 into lp:maria


Kristian Nielsen <knielsen@xxxxxxxxxxxxxxx> writes:

> So I will merge this into MariaDB with attached patch to disable PBMS and fix
> test failures.

Ok, so I merged it. But now I have a problem with PBXT crashing sometimes
during shutdown.

To reproduce, run the following command in a build of lp:maria:

    mkdir -p /tmp/x && sql/mysqld --no-defaults --basedir=$(pwd) --character-sets-dir=$(pwd)/sql/share/charsets --language=$(pwd)/sql/share/english --skip-networking --datadir=/tmp/x --skip-grant-tables --nonexistentoption

This is supposed to complain about bad --nonexistentoption, and exit.

Instead, in about 75% of cases it crashes during shutdown :-(.

Basically, it crashes when the thread that calls xt_init_databases() is
different from the thread that calls xt_stop_database_threads(),
xt_exit_databases(), and db_finalize(). For some reason, this is usually, but
not always, done in different threads in this scenario.

Here is the stack trace:

==16085== Invalid read of size 4
==16085==    at 0x9DFB78: xt_sl_delete(XTThread*, XTSortedList*, void*) (sortedlist_xt.cc:205)
==16085==    by 0xA14461: db_finalize(XTThread*, void*) (database_xt.cc:323)
==16085==    by 0x9C340E: xt_heap_release(XTThread*, XTHeap*) (heap_xt.cc:110)
==16085==    by 0xA133AA: xt_unuse_database(XTThread*, XTThread*) (database_xt.cc:662)
==16085==    by 0xA1341C: xt_db_exit_thread(XTThread*) (database_xt.cc:682)
==16085==    by 0x9F6F07: thr_exit(XTThread*) (thread_xt.cc:1051)
==16085==    by 0x9F711A: xt_free_thread(XTThread*) (thread_xt.cc:1445)
==16085==    by 0x9F9345: thr_main (thread_xt.cc:1028)
==16085==    by 0x50463F6: start_thread (pthread_create.c:297)
==16085==    by 0x6026B3C: clone (in /usr/lib/debug/libc-2.7.so)
==16085==  Address 0x44 is not stack'd, malloc'd or (recently) free'd

So, I do not know why the thread is sometimes the same and sometimes not in
startup and shutdown. I guess it is some kind of race condition?

Can you help with a suggestion on how to fix?

 - Kristian.

Follow ups