mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#26174 Server Crash:INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in Event
- Some variables in I_S.GLOBAL_STATUS were depending on a network connection in order to evaluate. Since no network connection is present during the execution of an event, this caused the server to crash. - The variable function hooks does now verify that the vio- object is valid before attempting to use it.
This commit is contained in:
@ -1408,4 +1408,32 @@ select user,db from information_schema.processlist;
|
|||||||
user db
|
user db
|
||||||
user3148 test
|
user3148 test
|
||||||
drop user user3148@localhost;
|
drop user user3148@localhost;
|
||||||
|
DROP TABLE IF EXISTS thread_status;
|
||||||
|
CREATE TABLE thread_status (variable_name VARCHAR(64),
|
||||||
|
variable_value DECIMAL(22,7));
|
||||||
|
CREATE TABLE server_status (variable_name VARCHAR(64),
|
||||||
|
variable_value DECIMAL(22,7));
|
||||||
|
DROP EVENT IF EXISTS log_status;
|
||||||
|
CREATE EVENT log_status
|
||||||
|
ON SCHEDULE EVERY 1 SECOND
|
||||||
|
DO
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO thread_status SELECT variable_name, variable_value FROM
|
||||||
|
information_schema.session_status;
|
||||||
|
INSERT INTO server_status SELECT variable_name, variable_value FROM
|
||||||
|
information_schema.global_status;
|
||||||
|
END$$
|
||||||
|
SET GLOBAL event_scheduler=1;
|
||||||
|
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
|
||||||
|
variable_name variable_value
|
||||||
|
SSL_ACCEPTS 0.0000000
|
||||||
|
SSL_CALLBACK_CACHE_HITS 0.0000000
|
||||||
|
SELECT variable_name FROM server_status LIMIT 1,2;
|
||||||
|
variable_name
|
||||||
|
ABORTED_CONNECTS
|
||||||
|
BINLOG_CACHE_DISK_USE
|
||||||
|
DROP EVENT log_status;
|
||||||
|
DROP TABLE thread_status;
|
||||||
|
DROP TABLE server_status;
|
||||||
|
SET GLOBAL event_scheduler=0;
|
||||||
End of 5.1 tests.
|
End of 5.1 tests.
|
||||||
|
@ -1042,5 +1042,45 @@ select user,db from information_schema.processlist;
|
|||||||
connection default;
|
connection default;
|
||||||
drop user user3148@localhost;
|
drop user user3148@localhost;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in Event
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
DROP TABLE IF EXISTS thread_status;
|
||||||
|
CREATE TABLE thread_status (variable_name VARCHAR(64),
|
||||||
|
variable_value DECIMAL(22,7));
|
||||||
|
CREATE TABLE server_status (variable_name VARCHAR(64),
|
||||||
|
variable_value DECIMAL(22,7));
|
||||||
|
DROP EVENT IF EXISTS log_status;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
DELIMITER $$;
|
||||||
|
|
||||||
|
CREATE EVENT log_status
|
||||||
|
ON SCHEDULE EVERY 1 SECOND
|
||||||
|
DO
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO thread_status SELECT variable_name, variable_value FROM
|
||||||
|
information_schema.session_status;
|
||||||
|
INSERT INTO server_status SELECT variable_name, variable_value FROM
|
||||||
|
information_schema.global_status;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;$$
|
||||||
|
|
||||||
|
SET GLOBAL event_scheduler=1;
|
||||||
|
sleep 1;
|
||||||
|
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
|
||||||
|
SELECT variable_name FROM server_status LIMIT 1,2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP EVENT log_status;
|
||||||
|
DROP TABLE thread_status;
|
||||||
|
DROP TABLE server_status;
|
||||||
|
SET GLOBAL event_scheduler=0;
|
||||||
|
|
||||||
--echo End of 5.1 tests.
|
--echo End of 5.1 tests.
|
||||||
|
|
||||||
|
@ -3803,6 +3803,8 @@ we force server id to 2, but this MySQL server will not act as a slave.");
|
|||||||
{
|
{
|
||||||
if (Events::get_instance()->init())
|
if (Events::get_instance()->init())
|
||||||
unireg_abort(1);
|
unireg_abort(1);
|
||||||
|
} else {
|
||||||
|
Events::opt_event_scheduler= Events::EVENTS_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signal threads waiting for server to be started */
|
/* Signal threads waiting for server to be started */
|
||||||
@ -6662,12 +6664,20 @@ static int show_ssl_ctx_get_session_cache_mode(THD *thd, SHOW_VAR *var, char *bu
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Functions relying on SSL */
|
/*
|
||||||
|
Functions relying on SSL
|
||||||
|
Note: In the show_ssl_* functions, we need to check if we have a
|
||||||
|
valid vio-object since this isn't always true, specifically
|
||||||
|
when session_status or global_status is requested from
|
||||||
|
inside an Event.
|
||||||
|
*/
|
||||||
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff)
|
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff)
|
||||||
{
|
{
|
||||||
var->type= SHOW_CHAR;
|
var->type= SHOW_CHAR;
|
||||||
var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
|
if( thd->vio_ok() && thd->net.vio->ssl_arg )
|
||||||
SSL_get_version((SSL*) thd->net.vio->ssl_arg) : "");
|
var->value= const_cast<char*>(SSL_get_version((SSL*) thd->net.vio->ssl_arg));
|
||||||
|
else
|
||||||
|
var->value= "";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6675,9 +6685,10 @@ static int show_ssl_session_reused(THD *thd, SHOW_VAR *var, char *buff)
|
|||||||
{
|
{
|
||||||
var->type= SHOW_LONG;
|
var->type= SHOW_LONG;
|
||||||
var->value= buff;
|
var->value= buff;
|
||||||
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
|
if( thd->vio_ok() && thd->net.vio->ssl_arg )
|
||||||
SSL_session_reused((SSL*) thd->net.vio->ssl_arg) :
|
*((long *)buff)= (long)SSL_session_reused((SSL*) thd->net.vio->ssl_arg);
|
||||||
0;
|
else
|
||||||
|
*((long *)buff)= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6685,9 +6696,10 @@ static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff)
|
|||||||
{
|
{
|
||||||
var->type= SHOW_LONG;
|
var->type= SHOW_LONG;
|
||||||
var->value= buff;
|
var->value= buff;
|
||||||
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
|
if( thd->vio_ok() && thd->net.vio->ssl_arg )
|
||||||
SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg) :
|
*((long *)buff)= (long)SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg);
|
||||||
0;
|
else
|
||||||
|
*((long *)buff)= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6695,9 +6707,10 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff)
|
|||||||
{
|
{
|
||||||
var->type= SHOW_LONG;
|
var->type= SHOW_LONG;
|
||||||
var->value= buff;
|
var->value= buff;
|
||||||
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
|
if( thd->net.vio && thd->net.vio->ssl_arg )
|
||||||
SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg) :
|
*((long *)buff)= (long)SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg);
|
||||||
0;
|
else
|
||||||
|
*((long *)buff)= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6705,17 +6718,20 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff)
|
|||||||
{
|
{
|
||||||
var->type= SHOW_LONG;
|
var->type= SHOW_LONG;
|
||||||
var->value= buff;
|
var->value= buff;
|
||||||
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
|
if( thd->vio_ok() && thd->net.vio->ssl_arg )
|
||||||
SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg) :
|
*((long *)buff)= (long)SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg);
|
||||||
0;
|
else
|
||||||
|
*((long *)buff)= 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff)
|
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff)
|
||||||
{
|
{
|
||||||
var->type= SHOW_CHAR;
|
var->type= SHOW_CHAR;
|
||||||
var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
|
if( thd->vio_ok() && thd->net.vio->ssl_arg )
|
||||||
SSL_get_cipher((SSL*) thd->net.vio->ssl_arg) : "");
|
var->value= const_cast<char*>(SSL_get_cipher((SSL*) thd->net.vio->ssl_arg));
|
||||||
|
else
|
||||||
|
var->value= "";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6723,7 +6739,7 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff)
|
|||||||
{
|
{
|
||||||
var->type= SHOW_CHAR;
|
var->type= SHOW_CHAR;
|
||||||
var->value= buff;
|
var->value= buff;
|
||||||
if (thd->net.vio->ssl_arg)
|
if (thd->vio_ok() && thd->net.vio->ssl_arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -4000,7 +4000,7 @@ sys_var_event_scheduler::update(THD *thd, set_var *var)
|
|||||||
DBUG_ENTER("sys_var_event_scheduler::update");
|
DBUG_ENTER("sys_var_event_scheduler::update");
|
||||||
if (Events::opt_event_scheduler == Events::EVENTS_DISABLED)
|
if (Events::opt_event_scheduler == Events::EVENTS_DISABLED)
|
||||||
{
|
{
|
||||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED");
|
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED or --skip-grant-tables");
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user