summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorSivert Sorumgard <sivert.sorumgaard@oracle.com>2019-12-13 13:03:08 +0100
committerSergei Golubchik <serg@mariadb.org>2020-04-30 10:13:21 +0200
commit39c60116e8065e9161f14f65ceb26e54782388bc (patch)
treed59e4fc3b55ec3c735eb2159978093c32d4defb2 /sql/event_scheduler.cc
parent6bb28e0bc52d415619ad33c60c05dfa2794a5412 (diff)
downloadmariadb-git-39c60116e8065e9161f14f65ceb26e54782388bc.tar.gz
Bug#30628268: OUT OF MEMORY CRASH
The event scheduler has a THD which is used for e.g. keeping track of the timing of the events. Thus, each scheduling of an event will make use of this THD, which in turn allocates memory in the THD's mem root. However, the mem root was never cleared, and hence, the memory occupied would monotonically increase throughout the life time of the server. The root cause was found by Jon Olav Hauglid, and this fix clears the THD's mem root for each event being scheduled. Change-Id: I462d2b9fd9658c9f33ab5080f7cd0e0ea28382df
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index dfb72007ec6..2f5487a3541 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2020, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -490,6 +491,7 @@ Event_scheduler::run(THD *thd)
DBUG_PRINT("info", ("job_data is NULL, the thread was killed"));
}
DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str));
+ free_root(thd->mem_root, MYF(0));
}
LOCK_DATA();