summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <andrey@whirlpool.mysql.com>2007-05-21 10:51:11 +0200
committerunknown <andrey@whirlpool.mysql.com>2007-05-21 10:51:11 +0200
commit3da4eef70072d713700219fb061cc497235477a3 (patch)
treefe97a37c60c26ae6368008b0300c3e22cc8dffc8
parent3d01594f349a540068943b1ba7ddea2ec2e448ef (diff)
downloadmariadb-git-3da4eef70072d713700219fb061cc497235477a3.tar.gz
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. sql/event_queue.cc: Initialize member variables or they will point to nirvana and could possible cause a crash during dumping of debug information. sql/event_queue.h: remove unneeded line sql/event_scheduler.cc: Initialize member variables or they will point to nirvana and could possible cause a crash during dumping of debug information. sql/event_scheduler.h: remove unneeded state
-rw-r--r--sql/event_queue.cc15
-rw-r--r--sql/event_queue.h1
-rw-r--r--sql/event_scheduler.cc9
-rw-r--r--sql/event_scheduler.h3
4 files changed, 19 insertions, 9 deletions
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index 5593e80b41b..40cb9040eef 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -70,10 +70,14 @@ event_queue_element_compare_q(void *vptr, byte* a, byte *b)
*/
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_queue_data_locked(FALSE),
- next_activation_at(0),
mutex_queue_data_attempting_lock(FALSE)
{
mutex_last_unlocked_in_func= mutex_last_locked_in_func=
@@ -739,8 +743,11 @@ Event_queue::dump_internal_status()
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
- printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
- time.year, time.month, time.day, time.hour, time.minute, time.second);
+ if (time.year != 1970)
+ printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
+ time.year, time.month, time.day, time.hour, time.minute, time.second);
+ else
+ printf("Next activation : never");
DBUG_VOID_RETURN;
}
diff --git a/sql/event_queue.h b/sql/event_queue.h
index 04bb8b93b06..ac4a4f2bfd7 100644
--- a/sql/event_queue.h
+++ b/sql/event_queue.h
@@ -104,7 +104,6 @@ private:
bool mutex_queue_data_locked;
bool mutex_queue_data_attempting_lock;
bool waiting_on_cond;
-
};
#endif /* _EVENT_QUEUE_H_ */
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 5844fecc227..478ae0098da 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -42,7 +42,6 @@ Event_db_repository *Event_worker_thread::db_repository;
static
const LEX_STRING scheduler_states_names[] =
{
- { C_STRING_WITH_LEN("UNINITIALIZED") },
{ C_STRING_WITH_LEN("INITIALIZED") },
{ C_STRING_WITH_LEN("RUNNING") },
{ C_STRING_WITH_LEN("STOPPING") }
@@ -331,9 +330,15 @@ end:
Event_scheduler::Event_scheduler(Event_queue *queue_arg)
- :state(UNINITIALIZED),
+ :state(INITIALIZED),
scheduler_thd(NULL),
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)
{
pthread_mutex_init(&LOCK_scheduler_state, MY_MUTEX_INIT_FAST);
diff --git a/sql/event_scheduler.h b/sql/event_scheduler.h
index 70635196745..eba66c68d42 100644
--- a/sql/event_scheduler.h
+++ b/sql/event_scheduler.h
@@ -111,8 +111,7 @@ private:
enum enum_state
{
- UNINITIALIZED = 0,
- INITIALIZED,
+ INITIALIZED = 0,
RUNNING,
STOPPING
};