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
This commit is contained in:
Sivert Sorumgard 2019-12-13 13:03:08 +01:00 committed by Sergei Golubchik
parent 6bb28e0bc5
commit 39c60116e8

View file

@ -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();