diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-06-13 15:54:12 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-06-13 16:05:45 +0400 |
commit | 2db724c8d2f3771c1a20b8cf9aaaf913b94aee68 (patch) | |
tree | ac8b3fba1144f8990c9598cdf1cba61c764ea688 /sql/threadpool_unix.cc | |
parent | 3c77a00d55efe901db9cb52ec000cc93d909a3c9 (diff) | |
download | mariadb-git-2db724c8d2f3771c1a20b8cf9aaaf913b94aee68.tar.gz |
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.
Diffstat (limited to 'sql/threadpool_unix.cc')
-rw-r--r-- | sql/threadpool_unix.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index df1a05b3ebf..6075c758e40 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -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; } |