summaryrefslogtreecommitdiff
path: root/sql/sql_connect.cc
diff options
context:
space:
mode:
authoranozdrin/alik@quad. <>2008-03-12 17:44:40 +0300
committeranozdrin/alik@quad. <>2008-03-12 17:44:40 +0300
commit18125abf930b8fd5676c11218cd869d49dcd11a2 (patch)
treefe7296933dc1d17ddfb87e35b61bf5c0a3ed4684 /sql/sql_connect.cc
parente57679c2041ea549a1f6f1a4c1d7198543522907 (diff)
downloadmariadb-git-18125abf930b8fd5676c11218cd869d49dcd11a2.tar.gz
Fix for Bug#33507: Event scheduler creates more threads
than max_connections -- which results in user lockout. The problem was that the variable thread_count that contains the number of active threads was interpreted as a number of active connections. The fix is to introduce a new counter for active connections.
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r--sql/sql_connect.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index b22a33e3e92..6f8cd6494cd 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -402,10 +402,11 @@ check_user(THD *thd, enum enum_server_command command,
if (check_count)
{
- VOID(pthread_mutex_lock(&LOCK_thread_count));
- bool count_ok= thread_count <= max_connections + delayed_insert_threads
- || (thd->main_security_ctx.master_access & SUPER_ACL);
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
+ pthread_mutex_lock(&LOCK_connection_count);
+ bool count_ok= connection_count <= max_connections ||
+ (thd->main_security_ctx.master_access & SUPER_ACL);
+ VOID(pthread_mutex_unlock(&LOCK_connection_count));
+
if (!count_ok)
{ // too many connections
my_error(ER_CON_COUNT_ERROR, MYF(0));
@@ -930,7 +931,7 @@ bool setup_connection_thread_globals(THD *thd)
*/
-bool login_connection(THD *thd)
+static bool login_connection(THD *thd)
{
NET *net= &thd->net;
int error;
@@ -968,7 +969,7 @@ bool login_connection(THD *thd)
This mainly updates status variables
*/
-void end_connection(THD *thd)
+static void end_connection(THD *thd)
{
NET *net= &thd->net;
plugin_thdvar_cleanup(thd);