mirror of
https://github.com/MariaDB/server.git
synced 2025-08-14 06:21:33 +02:00

Remove one of the major sources of race condiitons in mariadb-test. Normally, mariadb_close() sends COM_QUIT to the server and immediately disconnects. In mariadb-test it means the test can switch to another connection and sends queries to the server before the server even started parsing the COM_QUIT packet and these queries can see the connection as fully active, as it didn't reach dispatch_command yet. This is a major source of instability in tests and many - but not all, still less than a half - tests employ workarounds. The correct one is a pair count_sessions.inc/wait_until_count_sessions.inc. Also very popular was wait_until_disconnected.inc, which was completely useless, because it verifies that the connection is closed, and after disconnect it always is, it didn't verify whether the server processed COM_QUIT. Sadly the placebo was as widely used as the real thing. Let's fix this by making mariadb-test `disconnect` command _to wait_ for the server to confirm. This makes almost all workarounds redundant. In some cases count_sessions.inc/wait_until_count_sessions.inc is still needed, though, as only `disconnect` command is changed: * after external tools, like `exec $MYSQL` * after failed `connect` command * replication, after `STOP SLAVE` * Federated/CONNECT/SPIDER/etc after `DROP TABLE` and also in some XA tests, because an XA transaction is dissociated from the THD very late, after the server has closed the client connection. Collateral cleanups: fix comments, remove some redundant statements: * DROP IF EXISTS if nothing is known to exist * DROP table/view before DROP DATABASE * REVOKE privileges before DROP USER etc
61 lines
1.6 KiB
Text
61 lines
1.6 KiB
Text
# Turn on ssl between the client and server
|
|
# and run a number of tests
|
|
|
|
-- source include/have_ssl_communication.inc
|
|
-- source include/big_test.inc
|
|
-- source include/have_64bit.inc
|
|
# No point in running with valgrind as it takes 1.5 hours
|
|
-- source include/not_valgrind.inc
|
|
# This test often times out with MemorySanitizer.
|
|
-- source include/not_msan.inc
|
|
|
|
#
|
|
# Bug#29579 Clients using SSL can hang the server
|
|
#
|
|
|
|
connect (ssl_con,localhost,root,,,,,SSL);
|
|
|
|
create table t1 (a int);
|
|
|
|
disconnect ssl_con;
|
|
|
|
|
|
--disable_query_log
|
|
--disable_result_log
|
|
|
|
let $count= 2000;
|
|
while ($count)
|
|
{
|
|
connect (ssl_con,localhost,root,,,,,SSL);
|
|
|
|
eval insert into t1 values ($count);
|
|
dec $count;
|
|
|
|
# This select causes the net buffer to fill as the server sends the results
|
|
# but the client doesn't reap the results. The results are larger each time
|
|
# through the loop, so that eventually the buffer is completely full
|
|
# at the exact moment the server attempts to the close the connection with
|
|
# the lock held.
|
|
send select * from t1;
|
|
|
|
# now send the quit the command so the server will initiate the shutdown.
|
|
send_quit ssl_con;
|
|
|
|
# if the server is hung, this will hang too:
|
|
connect (ssl_con2,localhost,root,,,,,SSL);
|
|
|
|
# no hang if we get here, close and retry
|
|
disconnect ssl_con2;
|
|
disconnect ssl_con;
|
|
}
|
|
--enable_query_log
|
|
--enable_result_log
|
|
|
|
connect (ssl_con,localhost,root,,,,,SSL);
|
|
|
|
drop table t1;
|
|
connection default;
|
|
disconnect ssl_con;
|
|
|
|
## This test file is for testing encrypted communication only, not other
|
|
## encryption routines that the SSL library happens to provide!
|