From e37639e9349b56296d452e69e970df939383d7e1 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sun, 13 Oct 2013 23:25:57 +0500 Subject: [PATCH] MDEV-5131 create_embedded_thd is not thread safe, libmysqld. LOCK_thread_count locked when we do threads.append(). --- libmysqld/lib_sql.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 88f8f039ce2..d5e5ecca2f5 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -683,8 +683,10 @@ void *create_embedded_thd(int client_flag) thd->data_tail= &thd->first_data; bzero((char*) &thd->net, sizeof(thd->net)); + mysql_mutex_lock(&LOCK_thread_count); thread_count++; threads.append(thd); + mysql_mutex_unlock(&LOCK_thread_count); thd->mysys_var= 0; return thd; err: