summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2020-05-04 00:15:00 +0400
committerSergey Vojtovich <svoj@mariadb.org>2020-05-06 13:53:07 +0400
commit725e43cefc422fe49fdbfe2f9252698b5c4a7175 (patch)
tree07ad77e09c91876409cdc2d06cfa7f7f4f6edec4 /sql/sql_connect.cc
parent91734431bac4384c07beda60e0cb374c7720e5c6 (diff)
downloadmariadb-git-bb-10.5-svoj.tar.gz
Thread_cache::unregistred_connections()bb-10.5-svoj
There is a gap between connection spawn time and connection becoming killable time (registration in server_threads). If shutdown is initiated when such connection is being executed through this gap, connection may access destroyed data or cause shutdown hang. Fixed by adding a counter of connections going through this gap and waiting until this counter drops down to 0 on shutdown. Part of MDEV-18353 - Shutdown may miss to wait for connection thread
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 420a054a1b2..b050e6edd43 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1377,6 +1377,8 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache)
/* Make THD visible in show processlist */
server_threads.insert(thd);
+ if (put_in_cache)
+ thread_cache.reset_unregistered();
thd->thr_create_utime= thr_create_utime;
/* We need to set this because of time_out_user_resource_limits */
@@ -1448,6 +1450,7 @@ end_thread:
thd->start_utime= thd->thr_create_utime;
server_threads.insert(thd);
+ thread_cache.reset_unregistered();
}
delete thd;
}