Commit 8cdeee17 authored by Jan Lindström's avatar Jan Lindström

MDEV-24509 : Warning: Memory not freed: 56 on SET @@global.wsrep_sst_auth

It seems that memory is not freed when updated value is NULL or
when wsrep is not initialized before shutdown.
parent cc2d6d1b
#
# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
#
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
......@@ -8,5 +5,14 @@ SET @@global.wsrep_sst_auth='foo:bar';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
disconnect node_2;
disconnect node_1;
connection node_2;
SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
Shutdown node_2
connection node_1;
connection node_2;
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
--source include/galera_cluster.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
--echo #
#
# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
#
SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth='foo:bar';
SELECT @@global.wsrep_sst_auth;
--source include/galera_end.inc
#
# MDEV-24509 Warning: Memory not freed: 56 on SET @@global.wsrep_sst_auth
#
--connection node_2
SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz';
SELECT @@global.wsrep_sst_auth;
--echo Shutdown node_2
--source include/shutdown_mysqld.inc
# On node_1, verify that the node has left the cluster.
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Restart node_2
--connection node_2
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT @@global.wsrep_sst_auth;
......@@ -2011,8 +2011,11 @@ static void __cdecl kill_server(int sig_ptr)
close_connections();
#ifdef WITH_WSREP
if (wsrep_inited == 1)
wsrep_deinit(true);
wsrep_sst_auth_free();
#endif /* WITH_WSREP */
if (sig != MYSQL_KILL_SIGNAL &&
sig != 0)
......@@ -2132,6 +2135,7 @@ extern "C" void unireg_abort(int exit_code)
/* In bootstrap mode we deinitialize wsrep here. */
if (opt_bootstrap && wsrep_inited)
wsrep_deinit(true);
wsrep_sst_auth_free();
}
#endif // WITH_WSREP
......
......@@ -149,6 +149,12 @@ static bool sst_auth_real_set (const char* value)
if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); }
wsrep_sst_auth= my_strdup(WSREP_SST_AUTH_MASK, MYF(0));
}
else
{
if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); }
wsrep_sst_auth= NULL;
}
return 0;
}
return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment