1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.


mysql-test/r/connect.result:
  A test case for Bug#33507: Event scheduler creates more threads
  than max_connections -- which results in user lockout.
mysql-test/t/connect.test:
  A test case for Bug#33507: Event scheduler creates more threads
  than max_connections -- which results in user lockout.
sql/mysql_priv.h:
  1. Polishing: login_connection() and end_connection() need not
     to be public.
  
  2. Introduce connection_count -- a variable to contain the number
     of active connections. It is protected by LOCK_connection_count.
sql/mysqld.cc:
  Use connection_count to count active connections.
sql/sql_connect.cc:
  1. Use connection_count to count active connections.
  2. Make login_connection(), end_connection() private for the module
  as they had to be.
This commit is contained in:
unknown
2008-03-12 17:44:40 +03:00
parent d80e7ce4e5
commit b279be388e
5 changed files with 231 additions and 14 deletions

View File

@ -115,3 +115,61 @@ create temporary table t2(id integer not null auto_increment primary key);
set @id := 1;
delete from t1 where id like @id;
drop table t1;
# ------------------------------------------------------------------
# -- End of 4.1 tests
# ------------------------------------------------------------------
# -- Bug#33507: Event scheduler creates more threads than max_connections
# -- which results in user lockout.
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
SET GLOBAL max_connections = 3;
SET GLOBAL event_scheduler = ON;
# -- Waiting for old connections to close...
# -- Disconnecting default connection...
# -- Check that we allow exactly three user connections, no matter how
# -- many threads are running.
# -- Connecting (1)...
# -- Waiting for root connection to close...
# -- Connecting (2)...
# -- Connecting (3)...
# -- Connecting (4)...
ERROR 08004: Too many connections
# -- Waiting for the last connection to close...
# -- Check that we allow one extra SUPER-user connection.
# -- Connecting super (1)...
# -- Connecting super (2)...
ERROR 00000: Too many connections
SELECT user FROM information_schema.processlist ORDER BY id;
user
event_scheduler
mysqltest_u1
mysqltest_u1
mysqltest_u1
root
# -- Resetting variables...
SET GLOBAL max_connections = 151;
SET GLOBAL event_scheduler = OFF;
# -- That's it. Closing connections...
# -- Restoring default connection...
# -- End of Bug#33507.
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------