MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/3/root/usr/share/mysql-test/r/connect_debug.result
# -- Bug#20201006: Spamming show processlist prevents old connection
# -- threads from cleaning up.
SET @saved_max_connections = @@global.max_connections;
SET GLOBAL max_connections = 2;

# -- Check that we allow only max_connections + 1 connections here
connect  con_1, localhost, root;
connect  con_2, localhost, root;
connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
connect  con_3, localhost, root;
ERROR HY000: Too many connections

# -- Ensure we have max_connections + 1 connections.
SELECT count(*)= @@global.max_connections + 1 FROM information_schema.processlist;
count(*)= @@global.max_connections + 1
1

# -- Take LOCK_thd_remove and close one connection then
# attempt new one [should fail]...
SET DEBUG_SYNC='fill_schema_processlist_after_copying_threads SIGNAL disconnect_connection WAIT_FOR continue';
SELECT user FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY user;;
connection default;
SET DEBUG_SYNC='now WAIT_FOR disconnect_connection';
disconnect con_1;
connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK);
connect  con_3, localhost, root;
ERROR HY000: Too many connections

# -- Release the lock. Now new connection should go through
SET DEBUG_SYNC='now SIGNAL continue';
connection con_2;
user
root
SET DEBUG_SYNC='RESET';

# -- Waiting for connection to close...
connect  con_3, localhost, root;

# -- Closing connections...
disconnect con_3;
disconnect con_2;
connection default;

# -- Resetting variables...
SET GLOBAL max_connections= @saved_max_connections;

# -- End of Bug#20201006.