From aa5a63be146ba3cf2b6c1560030c6532117fa0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 23 Oct 2020 10:53:26 +0300 Subject: [PATCH 1/6] Fix debug argument concatenation The buffer was shorter than the arguments given to it which caused a heap buffer overflow. --- server/core/gateway.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/core/gateway.cc b/server/core/gateway.cc index bfc99d85f..a4155f325 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -3322,7 +3322,7 @@ static bool handle_debug_args(char* args) size_t total_len = 1; for (int i = 0; debug_arguments[i].action != NULL; i++) { - total_len += strlen(debug_arguments[i].name) + 1; + total_len += strlen(debug_arguments[i].name) + 2; } char arglist[total_len]; arglist[0] = '\0'; From e522bce80fb086e08f26dd65cc86f134441c3406 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 27 Oct 2020 13:57:34 +0200 Subject: [PATCH 2/6] MXS-3249 Fix mysqltest tests To avouid failures caused by default MariaDB configuration files containing entries incompatible with mysqltest, mysqltest is invoked with the glah --no-defaults, which will cause it *not* to read any configuration files. --- system-test/cache_basic.sh | 3 ++- system-test/masking_user.sh | 6 ++++-- system-test/mysqltest_driver.sh | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/system-test/cache_basic.sh b/system-test/cache_basic.sh index 97e522cdb..e5d67910c 100755 --- a/system-test/cache_basic.sh +++ b/system-test/cache_basic.sh @@ -18,7 +18,8 @@ function run_test echo $test_name logdir=log_$test_name mkdir -p $logdir - mysqltest --host=${maxscale_000_network} --port=$port \ + mysqltest --no-defaults \ + --host=${maxscale_000_network} --port=$port \ --user=$user --password=$password \ --logdir=$logdir \ --test-file=$dir/t/$test_name.test \ diff --git a/system-test/masking_user.sh b/system-test/masking_user.sh index 181bb4cff..baa92e09f 100755 --- a/system-test/masking_user.sh +++ b/system-test/masking_user.sh @@ -34,7 +34,8 @@ dir="$src_dir/masking/$1" user=skysql test_name=masking_user -mysqltest --host=${maxscale_000_network} --port=$port \ +mysqltest --no-defaults \ + --host=${maxscale_000_network} --port=$port \ --user=$maxscale_user --password=$maxscale_password \ --logdir=$logdir \ --test-file=$dir/t/$test_name.test \ @@ -50,7 +51,8 @@ fi user=maxskysql test_name=masking_user -mysqltest --host=${maxscale_000_network} --port=$port \ +mysqltest --no-defaults \ + --host=${maxscale_000_network} --port=$port \ --user=$maxscale_user --password=$maxscale_password \ --logdir=$logdir \ --test-file=$dir/t/$test_name.test \ diff --git a/system-test/mysqltest_driver.sh b/system-test/mysqltest_driver.sh index aea4cf0ac..f8fb48db7 100755 --- a/system-test/mysqltest_driver.sh +++ b/system-test/mysqltest_driver.sh @@ -47,7 +47,8 @@ for t in `ls $2/t/*.test|xargs -L 1 basename` do printf "$t:" test_name=${t%%.test} - mysqltest --host=${maxscale_000_network} --port=$port \ + mysqltest --no-defaults \ + --host=${maxscale_000_network} --port=$port \ --user=$user --password=$password \ --logdir=log_$1 \ --test-file=$2/t/$test_name.test \ From d45eb051bf16ebf701c6257bf9345ff579767c8b Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 27 Oct 2020 16:09:41 +0200 Subject: [PATCH 3/6] MXS-3249 Remove spaces from object names --- system-test/cnf/maxscale.cnf.template.mxs421_events | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system-test/cnf/maxscale.cnf.template.mxs421_events b/system-test/cnf/maxscale.cnf.template.mxs421_events index f658d419f..7376c0327 100644 --- a/system-test/cnf/maxscale.cnf.template.mxs421_events +++ b/system-test/cnf/maxscale.cnf.template.mxs421_events @@ -4,6 +4,8 @@ threads=###threads### #event.authentication_failure.facility=LOG_AUTH #event.authentication_failure.level=LOG_ERR +syslog=true + [MySQL-Monitor] type=monitor module=mysqlmon @@ -21,7 +23,7 @@ password=skysql [RW-Split-Listener] type=listener -service=RW Split Router +service=RW-Split-Router protocol=MySQLClient port=4006 @@ -29,7 +31,7 @@ port=4006 type=service router=cli -[CLI Listener] +[CLI-Listener] type=listener service=CLI protocol=maxscaled From ca1db89994ac738b418f3dd46fdb270ee0294266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 26 Oct 2020 20:56:05 +0200 Subject: [PATCH 4/6] MXS-3259: Increase connection limits Lowering max_connections to 10 prevented the test system itself from connecting to it. The replication slaves count towards max_connections and with up to 15 connections in the test, the limit should be higher. --- system-test/backend_auth_fail.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/system-test/backend_auth_fail.cpp b/system-test/backend_auth_fail.cpp index 06db352f0..19376d252 100644 --- a/system-test/backend_auth_fail.cpp +++ b/system-test/backend_auth_fail.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) MYSQL* mysql[1000]; TestConnections* Test = new TestConnections(argc, argv); - Test->repl->execute_query_all_nodes((char*) "set global max_connections = 10;"); + Test->repl->execute_query_all_nodes((char*) "set global max_connections = 30;"); for (int x = 0; x < 3; x++) { @@ -31,10 +31,6 @@ int main(int argc, char** argv) } } - // Wait for the connections to clean up - Test->stop_timeout(); - sleep(2 * Test->repl->N); - Test->check_maxscale_alive(0); int rval = Test->global_result; delete Test; From 46dab1e8841b81eb78d8c4ed39439ba2ad8c4984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 28 Oct 2020 13:16:21 +0200 Subject: [PATCH 5/6] MXS-3259: Add default connection timeout The connector never times out if one is not defined. This seems to help make the mxs1985_kill_hang test a lot more stable. --- system-test/maxtest/src/mariadb_func.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system-test/maxtest/src/mariadb_func.cc b/system-test/maxtest/src/mariadb_func.cc index 9c2cd4054..da136d7b4 100644 --- a/system-test/maxtest/src/mariadb_func.cc +++ b/system-test/maxtest/src/mariadb_func.cc @@ -50,6 +50,9 @@ MYSQL* open_conn_db_flags(int port, set_ssl(conn); } + unsigned int timeout = 15; + mysql_options(conn, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); + // MXS-2568: This fixes mxs1828_double_local_infile mysql_optionsv(conn, MYSQL_OPT_LOCAL_INFILE, (void*)"1"); From 87f97a16c315bb4ada7fe6c5800fea9cb4c33a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 29 Oct 2020 15:33:48 +0200 Subject: [PATCH 6/6] Log server name in error message This makes it clear which server failed. --- .../protocol/MySQL/mariadbbackend/mysql_backend.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc index 92cd1048b..f563e9b83 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc @@ -68,8 +68,8 @@ struct AddressInfo }; static AddressInfo get_ip_string_and_port(const sockaddr_storage* sa); static bool gw_connection_established(DCB* dcb); -static bool gw_auth_is_complete(DCB* dcb); -json_t* gw_json_diagnostics(DCB* dcb); +static bool gw_auth_is_complete(DCB* dcb); +json_t* gw_json_diagnostics(DCB* dcb); extern "C" { @@ -604,16 +604,20 @@ static std::string get_detailed_error(DCB* dcb) { std::ostringstream ss; + ss << " (" << dcb->server->name(); + if (int err = gw_getsockerrno(dcb->fd)) { - ss << " (" << err << ", " << mxs_strerror(err) << ")"; + ss << ": " << err << ", " << mxs_strerror(err); } else if (dcb->is_fake_event) { // Fake events should not have TCP socket errors - ss << " (Generated event)"; + ss << ": Generated event"; } + ss << ")"; + return ss.str(); }