Skip to content
  • Neha Kumari's avatar
    56496f29
    Bug#24679056:MULTI-THREADED SLAVE LEAKS WORKER THREADS IN CASE OF THREAD CREATE FAILURE · 56496f29
    Neha Kumari authored
    Problem:
    If one adds SHOW PROCESSLIST to the end of rpl.rpl_mts_debug.test, it will show
    an orphaned SQL worker thread that is there regardless that the slave is
    stopped. It is a thread created by mts_worker_thread_fails failure injection
    point testcase, which tries to set up MTS with two worker threads and
    simulates a pthread_create failure for one of them.
    
    Analysis:
    The root cause is that the variable slave_parallel_workers will not be
    incremented in case of failure in slave_start_single_worker
    (caused here by "mts_worker_thread_fails" injection). This will end up
    causing an early exist in slave_stop_worker
    
    void slave_stop_workers(Relay_log_info rli, bool mts_inited)
    {
      int i;
      THD thd= rli->info_thd; if (!mts_inited)
        return;
      else if (rli->slave_parallel_workers == 0)
        goto end;
    
    Fix:
    Incremenet the variable slave_parallel_worker for every successful call to
    the method slave_start_single_worker(). In this way the early exist will be
    avoided when there are worker threads present which needed to be stopped.
    56496f29
    Bug#24679056:MULTI-THREADED SLAVE LEAKS WORKER THREADS IN CASE OF THREAD CREATE FAILURE
    Neha Kumari authored
    Problem:
    If one adds SHOW PROCESSLIST to the end of rpl.rpl_mts_debug.test, it will show
    an orphaned SQL worker thread that is there regardless that the slave is
    stopped. It is a thread created by mts_worker_thread_fails failure injection
    point testcase, which tries to set up MTS with two worker threads and
    simulates a pthread_create failure for one of them.
    
    Analysis:
    The root cause is that the variable slave_parallel_workers will not be
    incremented in case of failure in slave_start_single_worker
    (caused here by "mts_worker_thread_fails" injection). This will end up
    causing an early exist in slave_stop_worker
    
    void slave_stop_workers(Relay_log_info rli, bool mts_inited)
    {
      int i;
      THD thd= rli->info_thd; if (!mts_inited)
        return;
      else if (rli->slave_parallel_workers == 0)
        goto end;
    
    Fix:
    Incremenet the variable slave_parallel_worker for every successful call to
    the method slave_start_single_worker(). In this way the early exist will be
    avoided when there are worker threads present which needed to be stopped.
Loading