Bug #76349 | memory leak in add_derived_key() | ||
---|---|---|---|
Submitted: | 17 Mar 2015 11:35 | Modified: | 19 Jul 2015 21:30 |
Reporter: | Vlad Lesin | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[17 Mar 2015 11:35]
Vlad Lesin
[18 Mar 2015 8:42]
Vlad Lesin
The second tables is not necessary for the test case: create table t1 (a int unsigned auto_increment primary key, b int(10) unsigned not null default 0); insert into t1 (b) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); delimiter | create procedure mem_leak() select a from (select * from t1) as d_t where d_t.a = 5; | delimiter ; call mem_leak();
[18 Mar 2015 14:02]
MySQL Verification Team
Thanks for the report! Testcas uses up endless memory: -------- drop table if exists t1,t2 create table t1 (a int unsigned auto_increment primary key,b int(10) unsigned not null default 0); create table t2 (a int unsigned auto_increment primary key,b int(10) unsigned not null default 0); insert into t1 (b) values (1), (2),(3),(4),(5),(6),(7),(8),(9),(10); insert into t2 (b) values (1), (2),(3),(4),(5),(6),(7),(8),(9),(10); delimiter $ create procedure p1() begin repeat select a from (select * from t2) as d_t where d_t.a = 5; until 1=2 end repeat; end $ delimiter ; call p1(); ------
[18 Mar 2015 14:03]
MySQL Verification Team
heap profile.
Attachment: bug76349_5.6.25_heap_profile.pdf (application/pdf, text), 14.22 KiB.
[18 Mar 2015 14:10]
MySQL Verification Team
Affects only 5.6, did not leak on 5.1, 5.5, 5.7, 5.8.
[14 May 2015 8:36]
Vojtech Kurka
Percona release a fix that works: https://bugs.launchpad.net/percona-server/+bug/1380985
[19 Jul 2015 21:30]
Paul DuBois
Noted in 5.6.27, 5.7.9, 5.8.0 changelogs. The optimizer sometimes generates an index for a derived table (subquery in the FROM clause). If this occurred for a statement executed within a stored program, a memory leak could occur.