summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-03-09 10:19:09 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2016-03-09 10:19:09 +0100
commit351026ca535179abb956c5ad1e1d59aac0835254 (patch)
tree3ea50c4f9cfaa117abf3e3a6641a90424ea1ea45 /sql/threadpool_common.cc
parentf12229f63ecbc12571d2333dfbc02c358e8ed817 (diff)
downloadmariadb-git-351026ca535179abb956c5ad1e1d59aac0835254.tar.gz
Fix threadpool memory leak and connect2 test
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 7cba3f014f4..1653075a916 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -122,13 +122,19 @@ THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
pthread_setspecific(THR_KEY_mysys, 0);
my_thread_init();
st_my_thread_var* mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
- DBUG_EXECUTE_IF("simulate_failed_connection_1", mysys_var= NULL; my_thread_end(););
if (!mysys_var ||!(thd= connect->create_thd()))
{
/* Out of memory? */
connect->close_and_delete();
if (mysys_var)
{
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ current PSI is still from worker thread.
+ Set to 0, to avoid premature cleanup by my_thread_end
+ */
+ if (PSI_server) PSI_server->set_thread(0);
+#endif
my_thread_end();
}
worker_context.restore();