List:Commits« Previous MessageNext Message »
From:kpettersson Date:March 14 2007 5:11pm
Subject:bk commit into 5.1 tree (Kristofer.Pettersson:1.2464) BUG#26174
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of Kristofer Pettersson. When Kristofer Pettersson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-14 18:10:40+01:00, Kristofer.Pettersson@naruto. +3 -0
  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.

  mysql-test/r/information_schema.result@stripped, 2007-03-14 18:10:26+01:00, Kristofer.Pettersson@naruto. +19 -0
    Added test case.

  mysql-test/t/information_schema.test@stripped, 2007-03-14 18:10:26+01:00, Kristofer.Pettersson@naruto. +32 -0
    Added test case.

  sql/mysqld.cc@stripped, 2007-03-14 18:10:27+01:00, Kristofer.Pettersson@naruto. +60 -17
    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 is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	Kristofer.Pettersson
# Host:	naruto.
# Root:	C:/cpp/bug26174/my51-bug26174

--- 1.614/sql/mysqld.cc	2007-03-14 18:11:07 +01:00
+++ 1.615/sql/mysqld.cc	2007-03-14 18:11:07 +01:00
@@ -6666,8 +6666,15 @@ static int show_ssl_ctx_get_session_cach
 static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff)
 {
   var->type= SHOW_CHAR;
-  var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
-        SSL_get_version((SSL*) thd->net.vio->ssl_arg) : "");
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->vio_ok() && thd->net.vio->ssl_arg )
+    var->value= const_cast<char*>(SSL_get_version((SSL*) thd->net.vio->ssl_arg));
+  else
+    var->value= "";
   return 0;
 }
 
@@ -6675,9 +6682,15 @@ static int show_ssl_session_reused(THD *
 {
   var->type= SHOW_LONG;
   var->value= buff;
-  *((long *)buff)= (long)thd->net.vio->ssl_arg ?
-                         SSL_session_reused((SSL*) thd->net.vio->ssl_arg) :
-                         0;
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->vio_ok() && thd->net.vio->ssl_arg )
+    *((long *)buff)= (long)SSL_session_reused((SSL*) thd->net.vio->ssl_arg);
+  else
+    *((long *)buff)= 0;
   return 0;
 }
 
@@ -6685,9 +6698,15 @@ static int show_ssl_get_default_timeout(
 {
   var->type= SHOW_LONG;
   var->value= buff;
-  *((long *)buff)= (long)thd->net.vio->ssl_arg ?
-                         SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg) :
-                         0;
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->vio_ok() && thd->net.vio->ssl_arg )
+    *((long *)buff)= (long)SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg);
+  else
+    *((long *)buff)= 0;
   return 0;
 }
 
@@ -6695,9 +6714,15 @@ static int show_ssl_get_verify_mode(THD 
 {
   var->type= SHOW_LONG;
   var->value= buff;
-  *((long *)buff)= (long)thd->net.vio->ssl_arg ?
-                         SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg) :
-                         0;
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->net.vio && thd->net.vio->ssl_arg )
+    *((long *)buff)= (long)SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg);
+  else
+    *((long *)buff)= 0;
   return 0;
 }
 
@@ -6705,17 +6730,30 @@ static int show_ssl_get_verify_depth(THD
 {
   var->type= SHOW_LONG;
   var->value= buff;
-  *((long *)buff)= (long)thd->net.vio->ssl_arg ?
-                         SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg) :
-                         0;
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->vio_ok() && thd->net.vio->ssl_arg )
+    *((long *)buff)= (long)SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg);
+  else
+    *((long *)buff)= 0;
   return 0;
 }
 
 static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff)
 {
   var->type= SHOW_CHAR;
-  var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
-              SSL_get_cipher((SSL*) thd->net.vio->ssl_arg) : "");
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */
+  if( thd->vio_ok() && thd->net.vio->ssl_arg )
+    var->value= const_cast<char*>(SSL_get_cipher((SSL*) thd->net.vio->ssl_arg));
+  else
+    var->value= "";
   return 0;
 }
 
@@ -6723,7 +6761,12 @@ static int show_ssl_get_cipher_list(THD 
 {
   var->type= SHOW_CHAR;
   var->value= buff;
-  if (thd->net.vio->ssl_arg)
+  /*
+     We need to check if we have a valid vio-object
+     since this isn't always true, specifically when
+     global_status is requested from inside an Event.
+   */  
+  if (thd->vio_ok() && thd->net.vio->ssl_arg)
   {
     int i;
     const char *p;

--- 1.147/mysql-test/r/information_schema.result	2007-03-14 18:11:07 +01:00
+++ 1.148/mysql-test/r/information_schema.result	2007-03-14 18:11:07 +01:00
@@ -1408,4 +1408,23 @@ select user,db from information_schema.p
 user	db
 user3148	test
 drop user user3148@localhost;
+DROP TABLE IF EXISTS thread_status;
+CREATE TABLE thread_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.global_status;
+END$$
+SET GLOBAL event_scheduler=1;
+SELECT * FROM thread_status LIMIT 1,2;
+variable_name	variable_value
+ABORTED_CONNECTS	0.0000000
+BINLOG_CACHE_DISK_USE	0.0000000
+DROP EVENT log_status;
+DROP TABLE thread_status;
+SET GLOBAL event_scheduler=0;
 End of 5.1 tests.

--- 1.94/mysql-test/t/information_schema.test	2007-03-14 18:11:07 +01:00
+++ 1.95/mysql-test/t/information_schema.test	2007-03-14 18:11:07 +01:00
@@ -1042,5 +1042,37 @@ select user,db from information_schema.p
 connection default;
 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));
+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.global_status;
+ END$$
+
+DELIMITER ;$$
+
+SET GLOBAL event_scheduler=1;
+sleep 1;
+SELECT * FROM thread_status LIMIT 1,2;
+
+DROP EVENT log_status;
+DROP TABLE thread_status;
+SET GLOBAL event_scheduler=0;
+
 --echo End of 5.1 tests.
 


Thread
bk commit into 5.1 tree (Kristofer.Pettersson:1.2464) BUG#26174kpettersson14 Mar