Skip to content

Commit ce85612

Browse files
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.
1 parent 43894d6 commit ce85612

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

sql/event_queue.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ event_queue_element_compare_q(void *vptr, byte* a, byte *b)
7070
*/
7171

7272
Event_queue::Event_queue()
73-
:mutex_last_locked_at_line(0), mutex_last_unlocked_at_line(0),
73+
:next_activation_at(0),
74+
mutex_last_locked_at_line(0),
75+
mutex_last_unlocked_at_line(0),
76+
mutex_last_locked_in_func("n/a"),
77+
mutex_last_unlocked_in_func("n/a"),
78+
mutex_last_attempted_lock_in_func("n/a"),
7479
mutex_last_attempted_lock_at_line(0),
7580
mutex_queue_data_locked(FALSE),
76-
next_activation_at(0),
7781
mutex_queue_data_attempting_lock(FALSE)
7882
{
7983
mutex_last_unlocked_in_func= mutex_last_locked_in_func=
@@ -739,8 +743,11 @@ Event_queue::dump_internal_status()
739743

740744
MYSQL_TIME time;
741745
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
742-
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
743-
time.year, time.month, time.day, time.hour, time.minute, time.second);
746+
if (time.year != 1970)
747+
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
748+
time.year, time.month, time.day, time.hour, time.minute, time.second);
749+
else
750+
printf("Next activation : never");
744751

745752
DBUG_VOID_RETURN;
746753
}

sql/event_queue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ class Event_queue
104104
bool mutex_queue_data_locked;
105105
bool mutex_queue_data_attempting_lock;
106106
bool waiting_on_cond;
107-
108107
};
109108

110109
#endif /* _EVENT_QUEUE_H_ */

sql/event_scheduler.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Event_db_repository *Event_worker_thread::db_repository;
4242
static
4343
const LEX_STRING scheduler_states_names[] =
4444
{
45-
{ C_STRING_WITH_LEN("UNINITIALIZED") },
4645
{ C_STRING_WITH_LEN("INITIALIZED") },
4746
{ C_STRING_WITH_LEN("RUNNING") },
4847
{ C_STRING_WITH_LEN("STOPPING") }
@@ -331,9 +330,15 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
331330

332331

333332
Event_scheduler::Event_scheduler(Event_queue *queue_arg)
334-
:state(UNINITIALIZED),
333+
:state(INITIALIZED),
335334
scheduler_thd(NULL),
336335
queue(queue_arg),
336+
mutex_last_locked_at_line(0),
337+
mutex_last_unlocked_at_line(0),
338+
mutex_last_locked_in_func("n/a"),
339+
mutex_last_unlocked_in_func("n/a"),
340+
mutex_scheduler_data_locked(FALSE),
341+
waiting_on_cond(FALSE),
337342
started_events(0)
338343
{
339344
pthread_mutex_init(&LOCK_scheduler_state, MY_MUTEX_INIT_FAST);

sql/event_scheduler.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ class Event_scheduler
111111

112112
enum enum_state
113113
{
114-
UNINITIALIZED = 0,
115-
INITIALIZED,
114+
INITIALIZED = 0,
116115
RUNNING,
117116
STOPPING
118117
};

0 commit comments

Comments
 (0)