Skip to content
Permalink
Browse files

MDEV-7938 MariaDB Crashes Suddenly while writing binlogs

on disconnect THD must clean user_var_events array before
dropping temporary tables. Otherwise when binlogging a DROP,
it'll access user_var_events, but they were allocated
in the already freed memroot.
  • Loading branch information...
vuvova committed Apr 26, 2015
1 parent 053143e commit e26b2071bedb688435c7f77faef1f2bb564771f4
@@ -0,0 +1,8 @@
create table t1 (i int);
create trigger tr after insert on t1 for each row set @b=@a;
create temporary table tmp like t1;
insert into t1 values (1);
select * from t1;
i
1
drop table t1;
@@ -0,0 +1,17 @@
#
# MDEV-7938 MariaDB Crashes Suddenly while writing binlogs
#
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed.inc

--connect(con1,localhost,root,,)
create table t1 (i int);
create trigger tr after insert on t1 for each row set @b=@a;

create temporary table tmp like t1;
insert into t1 values (1);
--disconnect con1

--connection default
select * from t1;
drop table t1;
@@ -1394,6 +1394,7 @@ void THD::cleanup(void)
mysql_ha_cleanup(this);
locked_tables_list.unlock_locked_tables(this);

delete_dynamic(&user_var_events);
close_temporary_tables(this);

transaction.xid_state.xa_state= XA_NOTR;
@@ -1427,7 +1428,6 @@ void THD::cleanup(void)
debug_sync_end_thread(this);
#endif /* defined(ENABLED_DEBUG_SYNC) */

delete_dynamic(&user_var_events);
my_hash_free(&user_vars);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);

0 comments on commit e26b207

Please sign in to comment.
You can’t perform that action at this time.