Bug #79145 Memory Leak in Ha_innopart_share::set_v_templ partitioned on virtual column

Submitted: 6 Nov 2015 2:42 Modified: 12 Nov 2015 12:57
Reporter: Debarun Banerjee Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.7.10 OS:Any
Assigned to: CPU Architecture:Any

[6 Nov 2015 2:42] Debarun Banerjee
Description:
valgrind shows memory leak for subquery scan on partitioned table with virtual columns.

1,088 (176 direct, 912 indirect) bytes in 2 blocks are definitely lost in loss record 7 of 7
   at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x18895CC: ut_allocator<unsigned char>::allocate(unsigned long, unsigned char const*, char const*, bool, bool) (ut0new.h:342)
   by 0x1894A17: Ha_innopart_share::set_v_templ(TABLE*, dict_table_t*, char const*) (ha_innopart.cc:237)
   by 0x1896911: ha_innopart::open(char const*, int, unsigned int) (ha_innopart.cc:1125)
   by 0xECBC72: handler::ha_open(TABLE*, char const*, int, int) (handler.cc:2629)
   by 0x15E320A: open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool) (table.cc:3300)
   by 0x1467E67: open_table(THD*, TABLE_LIST*, Open_table_context*) (sql_base.cc:3454)

304 bytes in 2 blocks are indirectly lost in loss record 6 of 7
   at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x18895CC: ut_allocator<unsigned char>::allocate(unsigned long, unsigned char const*, char const*, bool, bool) (ut0new.h:342)
   by 0x186940B: innobase_build_v_templ(TABLE const*, dict_table_t const*, dict_vcol_templ_t*, dict_add_v_col_t const*, bool, char const*) (ha_innodb.cc:5157)
   by 0x1894B08: Ha_innopart_share::set_v_templ(TABLE*, dict_table_t*, char const*) (ha_innopart.cc:245)
   by 0x1896911: ha_innopart::open(char const*, int, unsigned int) (ha_innopart.cc:1125)
   by 0xECBC72: handler::ha_open(TABLE*, char const*, int, int) (handler.cc:2629)
   by 0x15E320A: open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool) (table.cc:3300)

How to repeat:
commit 4903997455887c434c6a06a6a6a8b4b24170d159
Author: Jimmy Yang <jimmy.yang@oracle.com>
Date:   Thu Nov 5 11:29:48 2015 +0800

create table t (
  a date,
  b blob,
  c tinyint,
  d longblob generated always as (c) virtual,
  e float,
  key i0001 (a),
  key i0000 (d(11))
) engine=innodb partition by key (c,a,e) partitions 2;
insert into t (a, b, c, e) values ('2015-10-13','a',-128,0);
insert into t (a, b, c, e) values ('2015-01-03','a',-128,0);
insert into t (a, b, c, e) values ('2015-09-14','a',0,0);
insert into t (a, b, c, e) values ('2015-07-19','a',0,0);
insert into t (a, b, c, e) values ('2014-10-30','a',-43,-32768);
insert into t (a, b, c, e) values ('2016-05-08','a',0,-1);
insert into t (a, b, c, e) values ('2015-05-04','a',43,0);
insert into t (a, b, c, e) values ('2015-06-03','a',1,1);
select d in(select d from t)from t group by d;

1. create a test file sample.test with above sql script.
2. ./mtr --valgrind sample
[12 Nov 2015 12:56] Jon Stephens
Documented fix in the MySQL 5.7.11 changelog as follows:

    Subquery scans on partitioned table with virtual columns could
    leak memory.

Closed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.