diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-01-25 17:04:09 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-01-25 17:04:09 +0100 |
commit | a2330c820af56d69e19f07f9cc9deb655fc67174 (patch) | |
tree | a946ecf6015f0e9736343d0fa55f82da99d2c8e2 /sql/wsrep_thd.cc | |
parent | 744e605de05354bdb18f9241daa8331687492f6b (diff) | |
download | mariadb-git-a2330c820af56d69e19f07f9cc9deb655fc67174.tar.gz |
MDEV-8208 Sporadic SEGFAULT on startup
different fix. remove old ones, wait for THD to be fully
initialized before continuing with the server startup process.
This reverts commits db2e21b, 13615c5, 3f515a0, 70113ee.
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r-- | sql/wsrep_thd.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index cb9822d1599..fb48c1ad60e 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -371,9 +371,20 @@ static void wsrep_replication_process(THD *thd) static bool create_wsrep_THD(wsrep_thd_processor_fun processor) { + ulong old_wsrep_running_threads= wsrep_running_threads; pthread_t unused; + mysql_mutex_lock(&LOCK_thread_count); bool res= pthread_create(&unused, &connection_attrib, start_wsrep_THD, (void*)processor); + /* + if starting a thread on server startup, wait until the this thread's THD + is fully initialized (otherwise a THD initialization code might + try to access a partially initialized server data structure - MDEV-8208). + */ + if (!mysqld_server_initialized) + while (old_wsrep_running_threads == wsrep_running_threads) + mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); + mysql_mutex_unlock(&LOCK_thread_count); return res; } |