From 3e589d4b8edf3d435a44cf71419a8355fe284f8e Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Tue, 17 Jan 2017 12:24:55 +0100 Subject: [PATCH] MDEV-11811: dual master with parallel replication memory leak in write master Gtid_list_log_event::do_apply_event() did not free_root(thd->mem_root). It can allocate on this in record_gtid(), and in some scenarios there is nothing else that does free_root(), leading to temporary memory leak until stop of SQL thread. One scenario is in circular replication with only one master active. The active master receives only its own events on the slave, all of which are ignored. But whenever the SQL thread catches up with the IO thread, a Gtid_list_log_event is applied, leading to the leak. --- sql/log_event.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/log_event.cc b/sql/log_event.cc index d311297f8a833..14f6bb20b47ee 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6915,6 +6915,7 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi) rli->abort_slave= true; rli->stop_for_until= true; } + free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC)); return ret; }