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.
This commit is contained in:
parent
0c9b77803c
commit
613297ff1e
@ -9426,9 +9426,11 @@ ndb_util_thread_fail:
|
|||||||
pthread_cond_signal(&COND_ndb_util_ready);
|
pthread_cond_signal(&COND_ndb_util_ready);
|
||||||
pthread_mutex_unlock(&LOCK_ndb_util_thread);
|
pthread_mutex_unlock(&LOCK_ndb_util_thread);
|
||||||
DBUG_PRINT("exit", ("ndb_util_thread"));
|
DBUG_PRINT("exit", ("ndb_util_thread"));
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(NULL);
|
return NULL; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3663,9 +3663,11 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
|
|||||||
ndb_binlog_thread_running= -1;
|
ndb_binlog_thread_running= -1;
|
||||||
pthread_mutex_unlock(&injector_mutex);
|
pthread_mutex_unlock(&injector_mutex);
|
||||||
pthread_cond_signal(&injector_cond);
|
pthread_cond_signal(&injector_cond);
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(NULL);
|
return NULL; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
lex_start(thd);
|
lex_start(thd);
|
||||||
|
|
||||||
@ -4376,10 +4378,11 @@ err:
|
|||||||
(void) pthread_cond_signal(&injector_cond);
|
(void) pthread_cond_signal(&injector_cond);
|
||||||
|
|
||||||
DBUG_PRINT("exit", ("ndb_binlog_thread"));
|
DBUG_PRINT("exit", ("ndb_binlog_thread"));
|
||||||
my_thread_end();
|
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(NULL);
|
return NULL; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1107,13 +1107,13 @@ void kill_mysql(void)
|
|||||||
|
|
||||||
#if defined(__NETWARE__)
|
#if defined(__NETWARE__)
|
||||||
extern "C" void kill_server(int sig_ptr)
|
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__)
|
#elif !defined(__WIN__)
|
||||||
static void *kill_server(void *sig_ptr)
|
static void *kill_server(void *sig_ptr)
|
||||||
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
|
#define RETURN_FROM_KILL_SERVER return 0
|
||||||
#else
|
#else
|
||||||
static void __cdecl kill_server(int sig_ptr)
|
static void __cdecl kill_server(int sig_ptr)
|
||||||
#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
|
#define RETURN_FROM_KILL_SERVER return
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DBUG_ENTER("kill_server");
|
DBUG_ENTER("kill_server");
|
||||||
@ -1121,7 +1121,10 @@ static void __cdecl kill_server(int sig_ptr)
|
|||||||
int sig=(int) (long) sig_ptr; // This is passed a int
|
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 there is a signal during the kill in progress, ignore the other
|
||||||
if (kill_in_progress) // Safety
|
if (kill_in_progress) // Safety
|
||||||
|
{
|
||||||
|
DBUG_LEAVE;
|
||||||
RETURN_FROM_KILL_SERVER;
|
RETURN_FROM_KILL_SERVER;
|
||||||
|
}
|
||||||
kill_in_progress=TRUE;
|
kill_in_progress=TRUE;
|
||||||
abort_loop=1; // This should be set
|
abort_loop=1; // This should be set
|
||||||
if (sig != 0) // 0 is not a valid signal number
|
if (sig != 0) // 0 is not a valid signal number
|
||||||
@ -1156,12 +1159,19 @@ static void __cdecl kill_server(int sig_ptr)
|
|||||||
pthread_join(select_thread, NULL); // wait for main thread
|
pthread_join(select_thread, NULL); // wait for main thread
|
||||||
#endif /* __NETWARE__ */
|
#endif /* __NETWARE__ */
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
/* purecov: end */
|
/* purecov: end */
|
||||||
|
|
||||||
#endif /* EMBEDDED_LIBRARY */
|
RETURN_FROM_KILL_SERVER; // Avoid compiler warnings
|
||||||
|
|
||||||
|
#else /* EMBEDDED_LIBRARY*/
|
||||||
|
|
||||||
|
DBUG_LEAVE;
|
||||||
RETURN_FROM_KILL_SERVER;
|
RETURN_FROM_KILL_SERVER;
|
||||||
|
|
||||||
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1935,8 +1945,9 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
|
|||||||
my_thread_end();
|
my_thread_end();
|
||||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
(void) pthread_cond_broadcast(&COND_thread_count);
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(0); // Impossible
|
return 0; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2756,7 +2767,9 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
|||||||
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
|
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
signal_thread_in_use= 0;
|
signal_thread_in_use= 0;
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
pthread_exit(0); // Safety
|
pthread_exit(0); // Safety
|
||||||
|
return 0; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
|
@ -638,9 +638,11 @@ err:
|
|||||||
if (recovery_captain)
|
if (recovery_captain)
|
||||||
mysql_close(recovery_captain);
|
mysql_close(recovery_captain);
|
||||||
delete thd;
|
delete thd;
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(0);
|
return 0; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2799,9 +2799,11 @@ err:
|
|||||||
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
|
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
|
||||||
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
|
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
|
||||||
pthread_mutex_unlock(&mi->run_lock);
|
pthread_mutex_unlock(&mi->run_lock);
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(0); // Can't return anything here
|
return 0; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3158,9 +3160,10 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
|
|||||||
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
|
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
|
||||||
pthread_mutex_unlock(&rli->run_lock); // tell the world we are done
|
pthread_mutex_unlock(&rli->run_lock); // tell the world we are done
|
||||||
|
|
||||||
|
DBUG_LEAVE; // Must match DBUG_ENTER()
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
DBUG_RETURN(0); // Can't return anything here
|
return 0; // Avoid compiler warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user