Commit 2db724c8 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-10218 - rpl.rpl_binlog_errors fails in buildbot with valgrind warnings -

             bytes are possibly lost

Timer thread of threadpool is created "joinable", but they're not "joined" on
completion. This causes memory leaks around thread local storage.

Fixed by joining timer thread.
parent 3c77a00d
......@@ -166,6 +166,7 @@ struct pool_timer_t
volatile uint64 next_timeout_check;
int tick_interval;
bool shutdown;
pthread_t timer_thread_id;
};
static pool_timer_t pool_timer;
......@@ -603,12 +604,12 @@ void check_stall(thread_group_t *thread_group)
static void start_timer(pool_timer_t* timer)
{
pthread_t thread_id;
DBUG_ENTER("start_timer");
mysql_mutex_init(key_timer_mutex,&timer->mutex, NULL);
mysql_cond_init(key_timer_cond, &timer->cond, NULL);
timer->shutdown = false;
mysql_thread_create(key_timer_thread,&thread_id, NULL, timer_thread, timer);
mysql_thread_create(key_timer_thread, &timer->timer_thread_id, NULL,
timer_thread, timer);
DBUG_VOID_RETURN;
}
......@@ -620,6 +621,7 @@ static void stop_timer(pool_timer_t *timer)
timer->shutdown = true;
mysql_cond_signal(&timer->cond);
mysql_mutex_unlock(&timer->mutex);
pthread_join(timer->timer_thread_id, NULL);
DBUG_VOID_RETURN;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment