Commit graph

7 commits

Author SHA1 Message Date
Sergei Golubchik
1cc67e090e MDEV-16153 Server crashes in Apc_target::disable, ASAN heap-use-after-free in Explain_query::~Explain_query upon/after EXECUTE IMMEDIATE
Explain_query must be created in the execution arena.
But JOIN::optimize_inner temporarily switches to the statement arena
under `if (sel->first_cond_optimization)`. This might cause
Explain_query to be allocated in the statement arena. Usually it is
harmless (although technically incorrect and a waste of memory), but
in case of EXECUTE IMMEDIATE, Prepared_statement object and its
statement arena are destroyed before log_slow_statement() call,
which uses Explain_query.

Fix:
1. Create Explain_query before switching arenas.
2. Before filling earlier-created Explain_query with data, set
thd->mem_root from the Explain_query::mem_root
2018-05-19 22:12:39 +02:00
Sergey Vojtovich
282497dd6d MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
Sergey Petrunya
bcd854fe33 MDEV-5308 Crash when running with slow_query_log=1
- Make log_slow_statement() always call delete_explain_query().
2013-11-21 16:29:46 +04:00
Sergey Petrunya
094f70fd19 MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT
- Don't save UNION's EXPLAIN data if optimization failed with 
  an error. We could end up saving incomplete plan, which will 
  cause a crash when we attempt to print it.
2013-10-10 20:30:32 +04:00
Sergey Petrunya
7d60030c02 MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
- If we're running explain with flags, use the same set of flags to make EXPLAIN columns 
  and contents.
2013-09-25 19:18:02 +04:00
Sergey Petrunya
ccca339459 MDEV-5047 virtual THD::~THD(): Assertion `status_var.memory_used == 0' fails
- Don't forget to delete the query plan footprint when 
  the query wasn't printed into slow query log for some reason
- ALso removed some garbage code.
2013-09-23 14:17:56 +04:00
Sergey Petrunya
d998a1635f MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='explain'
- Don't print a plan when the statement didn't produce it
- Also, add first testcase. We can't check the EXPLAIN from the slow log itself, though.
2013-09-20 17:45:24 +04:00