1 2# -- Bug#20201006: Spamming show processlist prevents old connection 3# -- threads from cleaning up. 4SET @saved_max_connections = @@global.max_connections; 5SET GLOBAL max_connections = 2; 6 7# -- Check that we allow only max_connections + 1 connections here 8connect con_1, localhost, root; 9connect con_2, localhost, root; 10connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK); 11connect con_3, localhost, root; 12ERROR HY000: Too many connections 13 14# -- Ensure we have max_connections + 1 connections. 15SELECT count(*)= @@global.max_connections + 1 FROM information_schema.processlist; 16count(*)= @@global.max_connections + 1 171 18 19# -- Take LOCK_thd_remove and close one connection then 20# attempt new one [should fail]... 21SET DEBUG_SYNC='fill_schema_processlist_after_copying_threads SIGNAL disconnect_connection WAIT_FOR continue'; 22SELECT user FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY user;; 23connection default; 24SET DEBUG_SYNC='now WAIT_FOR disconnect_connection'; 25disconnect con_1; 26connect(localhost,root,,test,MYSQL_PORT,MYSQL_SOCK); 27connect con_3, localhost, root; 28ERROR HY000: Too many connections 29 30# -- Release the lock. Now new connection should go through 31SET DEBUG_SYNC='now SIGNAL continue'; 32connection con_2; 33user 34root 35SET DEBUG_SYNC='RESET'; 36 37# -- Waiting for connection to close... 38connect con_3, localhost, root; 39 40# -- Closing connections... 41disconnect con_3; 42disconnect con_2; 43connection default; 44 45# -- Resetting variables... 46SET GLOBAL max_connections= @saved_max_connections; 47 48# -- End of Bug#20201006. 49 50