|
| 1 | + |
| 2 | +# This test makes no sense with the embedded server |
| 3 | +--source include/not_embedded.inc |
| 4 | + |
| 5 | +--source include/have_debug_sync.inc |
| 6 | + |
| 7 | +# Save the initial number of concurrent sessions |
| 8 | +--source include/count_sessions.inc |
| 9 | + |
| 10 | +--echo |
| 11 | +--echo # -- Bug#20201006: Spamming show processlist prevents old connection |
| 12 | +--echo # -- threads from cleaning up. |
| 13 | + |
| 14 | +--enable_connect_log |
| 15 | +SET @saved_max_connections = @@global.max_connections; |
| 16 | +SET GLOBAL max_connections = 2; |
| 17 | + |
| 18 | +--echo |
| 19 | +--echo # -- Check that we allow only max_connections + 1 connections here |
| 20 | +--connect (con_1, localhost, root) |
| 21 | +--connect (con_2, localhost, root) |
| 22 | +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
| 23 | +--error ER_CON_COUNT_ERROR |
| 24 | +--connect (con_3, localhost, root) |
| 25 | + |
| 26 | +--echo |
| 27 | +--echo # -- Ensure we have max_connections + 1 connections. |
| 28 | +SELECT count(*)= @@global.max_connections + 1 FROM information_schema.processlist; |
| 29 | + |
| 30 | +--echo |
| 31 | +--echo # -- Take LOCK_thd_remove and close one connection then |
| 32 | +--echo # attempt new one [should fail]... |
| 33 | +SET DEBUG_SYNC='inside_do_for_all_thd_copy SIGNAL disconnect_connection WAIT_FOR continue'; |
| 34 | +--send SELECT user FROM INFORMATION_SCHEMA.PROCESSLIST GROUP BY user; |
| 35 | + |
| 36 | +--connection default |
| 37 | +SET DEBUG_SYNC='now WAIT_FOR disconnect_connection'; |
| 38 | +--disconnect con_1 |
| 39 | + |
| 40 | +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
| 41 | +--error ER_CON_COUNT_ERROR |
| 42 | +--connect (con_3, localhost, root) |
| 43 | + |
| 44 | +--echo |
| 45 | +--echo # -- Release the lock. Now new connection should go through |
| 46 | +SET DEBUG_SYNC='now SIGNAL continue'; |
| 47 | +--connection con_2 |
| 48 | +reap; |
| 49 | + |
| 50 | +SET DEBUG_SYNC='RESET'; |
| 51 | + |
| 52 | +--echo |
| 53 | +--echo # -- Waiting for connection to close... |
| 54 | +let $count_sessions= 2; |
| 55 | +--source include/wait_until_count_sessions.inc |
| 56 | + |
| 57 | +--connect (con_3, localhost, root) |
| 58 | + |
| 59 | +--echo |
| 60 | +--echo # -- Closing connections... |
| 61 | +--disconnect con_3 |
| 62 | +--disconnect con_2 |
| 63 | +--source include/wait_until_disconnected.inc |
| 64 | + |
| 65 | +--connection default |
| 66 | + |
| 67 | +--echo |
| 68 | +--echo # -- Resetting variables... |
| 69 | +SET GLOBAL max_connections= @saved_max_connections; |
| 70 | + |
| 71 | +--disable_connect_log |
| 72 | + |
| 73 | +--echo |
| 74 | +--echo # -- End of Bug#20201006. |
| 75 | +--echo |
| 76 | + |
| 77 | +# Wait till all disconnects are completed |
| 78 | +let $count_sessions= 1; |
| 79 | +--source include/wait_until_count_sessions.inc |
0 commit comments