Bug #69066 Memory leak slave_parallel_workers
Submitted: 25 Apr 2013 9:38 Modified: 7 May 2013 18:11
Reporter: raza lei Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Memory storage engine Severity:S3 (Non-critical)
Version:5.6.11 OS:Any
Assigned to: CPU Architecture:Any
Tags: memory leak

[25 Apr 2013 9:38] raza lei
Description:
environment:MySQL 5.6.11

use the tool valgrind --tool=massif,we got it.
Due to slave_parallel_worker there is a memory leak on filtered slaves.
Memory leak when slave_parallel_workers = 8.Memory is 35MB change to 141MB.

grep 0x8C16D9 mysql_leak.log
| ->13.53% (35,246,416B)  0x8C16D9: alloc_root (my_alloc.c:224)
| ->19.93% (60,907,528B)  0x8C16D9: alloc_root (my_alloc.c:224)
| ->26.13% (95,265,384B)  0x8C16D9: alloc_root (my_alloc.c:224)
| ->28.77% (113,263,584B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->31.00% (129,233,992B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->31.52% (132,238,648B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->31.43% (132,372,272B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->31.97% (135,540,640B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->31.85% (135,598,824B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->32.30% (138,154,112B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->32.21% (138,557,944B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->32.64% (140,876,144B) 0x8C16D9: alloc_root (my_alloc.c:224)
| ->32.61% (141,829,944B) 0x8C16D9: alloc_root (my_alloc.c:224)

when slave_parallel_workers = 0,memory-leak disappear and memory keep at 4.7G
PID  USER   PR  NI  VIRT   RES   SHR S %CPU %MEM    TIME+   COMMAND                                                                                                                                                                       
8877 mysql  15  0   5432m  4.7g 7160 S 77.5 20.2  207:58.75  mysqld

Followed is the result used by valgrind --tool=massif

->46.67% (202,953,289B) 0x8C50F0: my_malloc (my_malloc.c:38)
| ->32.61% (141,829,944B) 0x8C16D9: alloc_root (my_alloc.c:224)
| | ->17.73% (77,093,640B) 0x91D0C7: innobase_create_handler(handlerton*, TABLE_SHARE*, st_mem_root*) (sql_alloc.h:40)
| | | ->17.73% (77,093,640B) 0x58B2E2: get_new_handler(TABLE_SHARE*, st_mem_root*, handlerton*) (handler.cc:442)
| | |   ->08.87% (38,557,224B) 0x7576D1: open_table_from_share(THD*, TABLE_SHARE*, char const*, unsigned int, unsigned int, unsigned int, TABLE*, bool) (table.cc:2102)
| | |   | ->08.87% (38,557,224B) 0x6853A1: open_table(THD*, TABLE_LIST*, Open_table_context*) (sql_base.cc:3047)
| | |   |   ->08.87% (38,557,224B) 0x6884FC: open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) (sql_base.cc:4516)
| | |   |     ->08.87% (38,557,224B) 0x68876F: open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) (sql_base.cc:5586)
| | |   |       ->08.86% (38,515,608B) 0x86556B: Rows_log_event::do_apply_event(Relay_log_info const*) (sql_base.h:472)
| | |   |       | ->08.86% (38,515,608B) 0x8AF111: slave_worker_exec_job(Slave_worker*, Relay_log_info*) (rpl_rli_pdb.cc:1880)
| | |   |       |   ->08.86% (38,515,608B) 0x895039: handle_slave_worker (rpl_slave.cc:4468)
| | |   |       |     ->08.86% (38,515,608B) 0x32A1A0677B: start_thread (in /lib64/libpthread-2.5.so)
| | |   |       |       ->08.86% (38,515,608B) 0x32A12D49AB: clone (in /lib64/libc-2.5.so)

How to repeat:
memory leak
[7 May 2013 18:11] Sveta Smirnova
Thank you for the report.

I assume this is same issue as bug #69075, so closing as duplicate of that one.