MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:September 23 2009 1:05pm
Subject:bzr commit into mysql-5.1-bugteam branch (alik:3119) Bug#47474
View as plain text  
#At file:///mnt/raid/alik/MySQL/bzr/bug47474/5.1-bugteam-bug47474/ based on revid:anurag.shekhar@stripped

 3119 Alexander Nozdrin	2009-09-23
      A patch for Bug#47474 (mysqld hits Dbug_violation_helper assert
      when compiled with Sun Studio compiler).
      
      The thing is that Sun Studio compiler calls destructor of stack
      objects when pthread_exit() is called. That triggered an assertion
      in DBUG_ENTER()/DBUG_RETURN() validation logic (if DBUG_ENTER() is
      used in the beginning of function, all returns should be replaced
      by DBUG_RETURN/DBUG_VOID_RETURN macros).
      
      A fix is to explicitly use DBUG_LEAVE macro.

    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/mysqld.cc
      sql/repl_failsafe.cc
      sql/slave.cc
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-06-19 08:24:43 +0000
+++ b/sql/ha_ndbcluster.cc	2009-09-23 13:05:05 +0000
@@ -9426,9 +9426,11 @@ ndb_util_thread_fail:
   pthread_cond_signal(&COND_ndb_util_ready);
   pthread_mutex_unlock(&LOCK_ndb_util_thread);
   DBUG_PRINT("exit", ("ndb_util_thread"));
+
+  DBUG_LEAVE;                               // Must match DBUG_ENTER()
   my_thread_end();
   pthread_exit(0);
-  DBUG_RETURN(NULL);
+  return NULL;                              // Avoid compiler warnings
 }
 
 /*

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2009-08-01 21:24:20 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2009-09-23 13:05:05 +0000
@@ -3663,9 +3663,11 @@ pthread_handler_t ndb_binlog_thread_func
     ndb_binlog_thread_running= -1;
     pthread_mutex_unlock(&injector_mutex);
     pthread_cond_signal(&injector_cond);
+
+    DBUG_LEAVE;                               // Must match DBUG_ENTER()
     my_thread_end();
     pthread_exit(0);
-    DBUG_RETURN(NULL);
+    return NULL;                              // Avoid compiler warnings
   }
   lex_start(thd);
 
@@ -4376,10 +4378,11 @@ err:
   (void) pthread_cond_signal(&injector_cond);
 
   DBUG_PRINT("exit", ("ndb_binlog_thread"));
-  my_thread_end();
 
+  DBUG_LEAVE;                               // Must match DBUG_ENTER()
+  my_thread_end();
   pthread_exit(0);
-  DBUG_RETURN(NULL);
+  return NULL;                              // Avoid compiler warnings
 }
 
 bool

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-09-18 13:19:58 +0000
+++ b/sql/mysqld.cc	2009-09-23 13:05:05 +0000
@@ -1107,13 +1107,13 @@ void kill_mysql(void)
 
 #if defined(__NETWARE__)
 extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
+#define RETURN_FROM_KILL_SERVER return
 #elif !defined(__WIN__)
 static void *kill_server(void *sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
+#define RETURN_FROM_KILL_SERVER return 0
 #else
 static void __cdecl kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
+#define RETURN_FROM_KILL_SERVER return
 #endif
 {
   DBUG_ENTER("kill_server");
@@ -1121,7 +1121,10 @@ static void __cdecl kill_server(int sig_
   int sig=(int) (long) sig_ptr;			// This is passed a int
   // if there is a signal during the kill in progress, ignore the other
   if (kill_in_progress)				// Safety
+  {
+    DBUG_LEAVE;
     RETURN_FROM_KILL_SERVER;
+  }
   kill_in_progress=TRUE;
   abort_loop=1;					// This should be set
   if (sig != 0) // 0 is not a valid signal number
@@ -1156,12 +1159,19 @@ static void __cdecl kill_server(int sig_
     pthread_join(select_thread, NULL);		// wait for main thread
 #endif /* __NETWARE__ */
 
+  DBUG_LEAVE;                                   // Must match DBUG_ENTER()
   my_thread_end();
   pthread_exit(0);
   /* purecov: end */
 
-#endif /* EMBEDDED_LIBRARY */
+  RETURN_FROM_KILL_SERVER;                      // Avoid compiler warnings
+
+#else /* EMBEDDED_LIBRARY*/
+
+  DBUG_LEAVE;
   RETURN_FROM_KILL_SERVER;
+
+#endif /* EMBEDDED_LIBRARY */
 }
 
 
@@ -1935,8 +1945,9 @@ bool one_thread_per_connection_end(THD *
   my_thread_end();
   (void) pthread_cond_broadcast(&COND_thread_count);
 
+  DBUG_LEAVE;                                   // Must match DBUG_ENTER()
   pthread_exit(0);
-  DBUG_RETURN(0);                               // Impossible
+  return 0;                                     // Avoid compiler warnings
 }
 
 
@@ -2757,7 +2768,9 @@ pthread_handler_t signal_hand(void *arg 
       DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
       my_thread_end();
       signal_thread_in_use= 0;
+      DBUG_LEAVE;                               // Must match DBUG_ENTER()
       pthread_exit(0);				// Safety
+      return 0;                                 // Avoid compiler warnings
     }
     switch (sig) {
     case SIGTERM:

=== modified file 'sql/repl_failsafe.cc'
--- a/sql/repl_failsafe.cc	2009-05-15 12:57:51 +0000
+++ b/sql/repl_failsafe.cc	2009-09-23 13:05:05 +0000
@@ -638,9 +638,11 @@ err:
   if (recovery_captain)
     mysql_close(recovery_captain);
   delete thd;
+
+  DBUG_LEAVE;                                   // Must match DBUG_ENTER()
   my_thread_end();
   pthread_exit(0);
-  DBUG_RETURN(0);
+  return 0;                                     // Avoid compiler warnings
 }
 #endif
 

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-09-18 08:20:29 +0000
+++ b/sql/slave.cc	2009-09-23 13:05:05 +0000
@@ -2799,9 +2799,11 @@ err:
   pthread_cond_broadcast(&mi->stop_cond);       // tell the world we are done
   DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
   pthread_mutex_unlock(&mi->run_lock);
+
+  DBUG_LEAVE;                                   // Must match DBUG_ENTER()
   my_thread_end();
   pthread_exit(0);
-  DBUG_RETURN(0);                               // Can't return anything here
+  return 0;                                     // Avoid compiler warnings
 }
 
 /*
@@ -3157,10 +3159,11 @@ the slave SQL thread with \"SLAVE START\
   pthread_cond_broadcast(&rli->stop_cond);
   DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
   pthread_mutex_unlock(&rli->run_lock);  // tell the world we are done
-  
+
+  DBUG_LEAVE;                                   // Must match DBUG_ENTER()
   my_thread_end();
   pthread_exit(0);
-  DBUG_RETURN(0);                               // Can't return anything here
+  return 0;                                     // Avoid compiler warnings
 }
 
 


Attachment: [text/bzr-bundle] bzr/alik@sun.com-20090923130505-0p6fpxaj9k6w6dxv.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (alik:3119) Bug#47474Alexander Nozdrin23 Sep