• Nirbhay Choubey's avatar
    MDEV-8208: Sporadic SEGFAULT on startup · 59037d96
    Nirbhay Choubey authored
    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.
    59037d96
mysqld.cc 341 KB