Fix for bug#28075 COM_DEBUG crashes mysqld

Uninitialized in the constructor member variables were
pointing to nirvana and causing a crash when debug information
of the Event Scheduler was dumped in result to COM_DEBUG
packet sent to the server.
parent 43894d62
...@@ -70,10 +70,14 @@ event_queue_element_compare_q(void *vptr, byte* a, byte *b) ...@@ -70,10 +70,14 @@ event_queue_element_compare_q(void *vptr, byte* a, byte *b)
*/ */
Event_queue::Event_queue() Event_queue::Event_queue()
:mutex_last_locked_at_line(0), mutex_last_unlocked_at_line(0), :next_activation_at(0),
mutex_last_locked_at_line(0),
mutex_last_unlocked_at_line(0),
mutex_last_locked_in_func("n/a"),
mutex_last_unlocked_in_func("n/a"),
mutex_last_attempted_lock_in_func("n/a"),
mutex_last_attempted_lock_at_line(0), mutex_last_attempted_lock_at_line(0),
mutex_queue_data_locked(FALSE), mutex_queue_data_locked(FALSE),
next_activation_at(0),
mutex_queue_data_attempting_lock(FALSE) mutex_queue_data_attempting_lock(FALSE)
{ {
mutex_last_unlocked_in_func= mutex_last_locked_in_func= mutex_last_unlocked_in_func= mutex_last_locked_in_func=
...@@ -739,8 +743,11 @@ Event_queue::dump_internal_status() ...@@ -739,8 +743,11 @@ Event_queue::dump_internal_status()
MYSQL_TIME time; MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at); my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
if (time.year != 1970)
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n", printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
time.year, time.month, time.day, time.hour, time.minute, time.second); time.year, time.month, time.day, time.hour, time.minute, time.second);
else
printf("Next activation : never");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -104,7 +104,6 @@ class Event_queue ...@@ -104,7 +104,6 @@ class Event_queue
bool mutex_queue_data_locked; bool mutex_queue_data_locked;
bool mutex_queue_data_attempting_lock; bool mutex_queue_data_attempting_lock;
bool waiting_on_cond; bool waiting_on_cond;
}; };
#endif /* _EVENT_QUEUE_H_ */ #endif /* _EVENT_QUEUE_H_ */
...@@ -42,7 +42,6 @@ Event_db_repository *Event_worker_thread::db_repository; ...@@ -42,7 +42,6 @@ Event_db_repository *Event_worker_thread::db_repository;
static static
const LEX_STRING scheduler_states_names[] = const LEX_STRING scheduler_states_names[] =
{ {
{ C_STRING_WITH_LEN("UNINITIALIZED") },
{ C_STRING_WITH_LEN("INITIALIZED") }, { C_STRING_WITH_LEN("INITIALIZED") },
{ C_STRING_WITH_LEN("RUNNING") }, { C_STRING_WITH_LEN("RUNNING") },
{ C_STRING_WITH_LEN("STOPPING") } { C_STRING_WITH_LEN("STOPPING") }
...@@ -331,9 +330,15 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event) ...@@ -331,9 +330,15 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
Event_scheduler::Event_scheduler(Event_queue *queue_arg) Event_scheduler::Event_scheduler(Event_queue *queue_arg)
:state(UNINITIALIZED), :state(INITIALIZED),
scheduler_thd(NULL), scheduler_thd(NULL),
queue(queue_arg), queue(queue_arg),
mutex_last_locked_at_line(0),
mutex_last_unlocked_at_line(0),
mutex_last_locked_in_func("n/a"),
mutex_last_unlocked_in_func("n/a"),
mutex_scheduler_data_locked(FALSE),
waiting_on_cond(FALSE),
started_events(0) started_events(0)
{ {
pthread_mutex_init(&LOCK_scheduler_state, MY_MUTEX_INIT_FAST); pthread_mutex_init(&LOCK_scheduler_state, MY_MUTEX_INIT_FAST);
......
...@@ -111,8 +111,7 @@ class Event_scheduler ...@@ -111,8 +111,7 @@ class Event_scheduler
enum enum_state enum enum_state
{ {
UNINITIALIZED = 0, INITIALIZED = 0,
INITIALIZED,
RUNNING, RUNNING,
STOPPING STOPPING
}; };
......
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