1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-8208: Sporadic SEGFAULT on startup

Problem:
When mysqld starts as a galera node, it creates 2 system threads
(applier & rollbacker) using start_wsrep_THD(). These threads are
created before plugin initialization (plugin_init()) for SST methods
like rsync and xtrabackup.

The threads' initialization itself can proceed in parallel to mysqld's
main thread of execution. As a result, the thread initialization code
(start_wsrep_THD()) can end up accessing some un/partially initialized
structures (like maria_hton, in this particular case) resulting in
segfault.

Solution:
Fixed by calling THD::init_for_queries() (which accesses maria_hton)
only after the plugins have been initialized.
This commit is contained in:
Nirbhay Choubey
2015-09-16 23:20:57 -04:00
parent fd1b2e486a
commit db2e21bf3e
3 changed files with 57 additions and 18 deletions

View File

@@ -65,6 +65,13 @@ my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
// restart will be needed
my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks
my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks
/*
Set during the creation of first wsrep applier and rollback threads.
Since these threads are critical, abort if the thread creation fails.
*/
my_bool wsrep_creating_startup_threads = 0;
/*
* End configuration options
*/
@@ -700,6 +707,7 @@ void wsrep_init_startup (bool first)
if (!wsrep_start_replication()) unireg_abort(1);
wsrep_creating_startup_threads= 1;
wsrep_create_rollbacker();
wsrep_create_appliers(1);