diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-07-14 18:03:53 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-07-24 15:08:08 +0200 |
commit | 4533e6ef65b8785bc846317dd3b7870211baef26 (patch) | |
tree | 2184bb037981e8a1fd489a777aa84ff92da0cdff /sql/sql_connect.cc | |
parent | b34cafe9d9fb6029d7aa6c5c18ef51c577aa637a (diff) | |
download | mariadb-git-4533e6ef65b8785bc846317dd3b7870211baef26.tar.gz |
MDEV-18353 Shutdown may miss to wait for connection thread
* count CONNECT objects too
* wait for all CONNECT objects to disappear (to be converted to THDs)
before killing THDs away
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 4d09dab392b..733d281efd5 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1360,6 +1360,14 @@ void do_handle_one_connection(CONNECT *connect) return; } + DBUG_EXECUTE_IF("CONNECT_wait", + { + extern MYSQL_SOCKET unix_sock; + DBUG_ASSERT(unix_sock.fd >= 0); + while (unix_sock.fd >= 0) + my_sleep(1000); + }); + /* If a thread was created to handle this connection: increment slow_launch_threads counter if it took more than @@ -1373,10 +1381,10 @@ void do_handle_one_connection(CONNECT *connect) if (launch_time >= slow_launch_time*1000000L) statistic_increment(slow_launch_threads, &LOCK_status); } - delete connect; - /* Make THD visible in show processlist */ - server_threads.insert(thd); + server_threads.insert(thd); // Make THD visible in show processlist + + delete connect; // must be after server_threads.insert, see close_connections() thd->thr_create_utime= thr_create_utime; /* We need to set this because of time_out_user_resource_limits */ @@ -1482,6 +1490,7 @@ CONNECT::~CONNECT() { if (vio) vio_delete(vio); + count--; } |