Bug #56381 valgrind leak warning from --suite=innodb_plugin

Submitted: 30 Aug 2010 18:45 Modified: 2 Feb 2013 13:58
Reporter: Mark Callaghan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S2 (Serious)
Version:5.1.50 OS:Any
Assigned to: Marko Mäkelä CPU Architecture:Any
Tags: innodb, Leak, mtr, plugin, valgrind

[30 Aug 2010 18:45] Mark Callaghan
Description:
Valgrind reports a leak when mysqld is shutdown during mtr --suite=innodb_plugin
The shutdown is done after innodb_plugin.innodb_trx_weight but any of the tests before it may have caused the leak.

==10281== 14 bytes in 1 blocks are indirectly lost in loss record 1 of 5
==10281==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==10281==    by 0x5C21FE5: ???
==10281==    by 0x5B79281: ???
==10281==    by 0x5BE64D6: ???
==10281==    by 0x5B9E9F1: ???
==10281==    by 0x6CBBE1: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
==10281==    by 0x5B7134: mysql_execute_command(THD*) (sql_parse.cc:2949)
==10281==    by 0x5B815E: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
==10281==    by 0x5B9398: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
==10281==    by 0x5BA36B: do_command(THD*) (sql_parse.cc:888)
==10281==    by 0x5A9332: handle_one_connection (sql_connect.cc:1136)
==10281==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==10281==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
==10281== 
==10281== 
==10281== 2,062 (568 direct, 1,494 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 5
==10281==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==10281==    by 0x5BB8BD1: ???
==10281==    by 0x5BB8CF5: ???
==10281==    by 0x5B793DE: ???
==10281==    by 0x5BE64D6: ???
==10281==    by 0x5B9E9F1: ???
==10281==    by 0x6CBBE1: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
==10281==    by 0x5B7134: mysql_execute_command(THD*) (sql_parse.cc:2949)
==10281==    by 0x5B815E: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
==10281==    by 0x5B9398: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
==10281==    by 0x5BA36B: do_command(THD*) (sql_parse.cc:888)
==10281==    by 0x5A9332: handle_one_connection (sql_connect.cc:1136)
==10281==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==10281==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
==10281== 
==10281== 
==10281== 1,480 bytes in 2 blocks are indirectly lost in loss record 5 of 5
==10281==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==10281==    by 0x5BB8BD1: ???
==10281==    by 0x5B791E6: ???
==10281==    by 0x5BE64D6: ???
==10281==    by 0x5B9E9F1: ???
==10281==    by 0x6CBBE1: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
==10281==    by 0x5B7134: mysql_execute_command(THD*) (sql_parse.cc:2949)
==10281==    by 0x5B815E: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
==10281==    by 0x5B9398: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
==10281==    by 0x5BA36B: do_command(THD*) (sql_parse.cc:888)
==10281==    by 0x5A9332: handle_one_connection (sql_connect.cc:1136)
==10281==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==10281==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)

How to repeat:
mysql-test-run.pl --force --valgrind --suite=innodb
gcc 4.2.1
valgrind 3.2.1
centos 5.2
64-bit x86

configure as ./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,innodb_plugin --without-plugin-innobase --with-fast-mutexes --with-extra-charsets=all --with-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_purify -DNO_ALARM -DSIGNAL_WITH_VIO_CLOSE -Wall"

mysql-test-run.pl --force --valgrind --suite=innodb_plugin
[30 Aug 2010 20:37] Sveta Smirnova
Thank you for the report.

Verified as described:

14 bytes in 1 blocks are indirectly lost in loss record 1 of 6
   at 0x4A05809: malloc (vg_replace_malloc.c:149)
   by 0x5E36735: ???
   by 0x5D898C0: ???
   by 0x5DF8901: ???
   by 0x5DB0558: ???
   by 0x6D500A: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
   by 0x5B8925: mysql_execute_command(THD*) (sql_parse.cc:2949)
   by 0x5BC1DA: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
   by 0x5BC787: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
   by 0x5BDCA4: do_command(THD*) (sql_parse.cc:888)
   by 0x5AD06F: handle_one_connection (sql_connect.cc:1136)
   by 0x3429E061B4: start_thread (in /lib64/libpthread-2.5.so)
   by 0x34292CD39C: clone (in /lib64/libc-2.5.so)

2,048 bytes in 1 blocks are still reachable in loss record 4 of 6
   at 0x4A05809: malloc (vg_replace_malloc.c:149)
   by 0x4A05883: realloc (vg_replace_malloc.c:306)
   by 0x3429E06D19: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.5.so)
   by 0x7E1818: my_thread_global_init (my_thr_init.c:115)
   by 0x7BD4EB: my_init (my_init.c:81)
   by 0x5A8F52: main (mysqld.cc:4331)

2,062 (224 direct, 1,838 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 6
   at 0x4A05809: malloc (vg_replace_malloc.c:149)
   by 0x5DC93FD: ???
   by 0x5D897B5: ???
   by 0x5DF8901: ???
   by 0x5DB0558: ???
   by 0x6D500A: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
   by 0x5B8925: mysql_execute_command(THD*) (sql_parse.cc:2949)
   by 0x5BC1DA: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
   by 0x5BC787: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
   by 0x5BDCA4: do_command(THD*) (sql_parse.cc:888)
   by 0x5AD06F: handle_one_connection (sql_connect.cc:1136)
   by 0x3429E061B4: start_thread (in /lib64/libpthread-2.5.so)
   by 0x34292CD39C: clone (in /lib64/libc-2.5.so)

1,824 bytes in 2 blocks are indirectly lost in loss record 6 of 6
   at 0x4A05809: malloc (vg_replace_malloc.c:149)
   by 0x5DC93FD: ???
   by 0x5DC951D: ???
   by 0x5D89A67: ???
   by 0x5DF8901: ???
   by 0x5DB0558: ???
   by 0x6D500A: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
   by 0x5B8925: mysql_execute_command(THD*) (sql_parse.cc:2949)
   by 0x5BC1DA: mysql_parse(THD*, char*, unsigned, char const**) (sql_parse.cc:6032)
   by 0x5BC787: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1260)
   by 0x5BDCA4: do_command(THD*) (sql_parse.cc:888)
   by 0x5AD06F: handle_one_connection (sql_connect.cc:1136)
   by 0x3429E061B4: start_thread (in /lib64/libpthread-2.5.so)
   by 0x34292CD39C: clone (in /lib64/libc-2.5.so)
[30 Aug 2010 21:10] Sveta Smirnova
Failed test: innodb_plugin.innodb-index
[31 Aug 2010 10:48] Marko Mäkelä
Sorry, I cannot repeat any leaks on my development tree. All I see is ‘still reachable’ warnings for some objects outside InnoDB:

==3968== 52 bytes in 1 blocks are still reachable in loss record 2 of 6
==3968==    at 0x4023C4C: malloc (vg_replace_malloc.c:195)
==3968==    by 0x40B7048: _mymalloc (safemalloc.c:137)
==3968==    by 0x40B83FC: _my_strdup (safemalloc.c:559)
==3968==    by 0x8051520: var_set(char const*, char const*, char const*, char const*) (mysqltest.cc:2103)
==3968==    by 0x80515F2: var_set_string(char const*, char const*) (mysqltest.cc:2114)
==3968==    by 0x805CC4F: main (mysqltest.cc:7782)
…
==3968== 59 bytes in 1 blocks are still reachable in loss record 5 of 6
==3968==    at 0x4023C4C: malloc (vg_replace_malloc.c:195)
==3968==    by 0x40B7048: _mymalloc (safemalloc.c:137)
==3968==    by 0x40B83FC: _my_strdup (safemalloc.c:559)
==3968==    by 0x8051520: var_set(char const*, char const*, char const*, char const*) (mysqltest.cc:2103)
==3968==    by 0x80515F2: var_set_string(char const*, char const*) (mysqltest.cc:2114)
==3968==    by 0x805CC3B: main (mysqltest.cc:7781)
…
==3968== 240 bytes in 4 blocks are still reachable in loss record 6 of 6
==3968==    at 0x4023C4C: malloc (vg_replace_malloc.c:195)
==3968==    by 0x40B7048: _mymalloc (safemalloc.c:137)
==3968==    by 0x40B769F: _myrealloc (safemalloc.c:249)
==3968==    by 0x40BD229: dynstr_append_mem (string.c:106)
==3968==    by 0x804E671: do_eval(st_dynamic_string*, char const*, char const*, char) (mysqltest.cc:814)
==3968==    by 0x804EE62: check_command_args(st_command*, char const*, command_arg const*, int, char) (mysqltest.cc:1012)
==3968==    by 0x8056F80: do_close_connection(st_command*) (mysqltest.cc:4761)
==3968==    by 0x805D3EB: main (mysqltest.cc:7958)

Before I go to fetch and compile the 5.1.50 source, can you please try to compile the InnoDB Plugin statically (swap the relevant parts of storage/innodb_plugin/plug.in and storage/innobase/plug.in, or something) to get a resolved stack trace for the InnoDB functions?
[31 Aug 2010 11:05] Marko Mäkelä
In Bug #55720, there is a innodb_swap_builtin_plugin.patch attached as http://bugs.mysql.com/file.php?id=15387
[31 Aug 2010 16:13] Mark Callaghan
From 5.1.50 + the facebook patch, the bug was found/filed for unmodified 5.1.50

==3649== 14 bytes in 1 blocks are still reachable in loss record 1 of 3
==3649==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==3649==    by 0x7FE3B2: ut_malloc_low (ut0mem.c:106)
==3649==    by 0x83626E: dict_mem_table_create (dict0mem.c:71)
==3649==    by 0x7D17EF: row_merge_create_temporary_table (row0merge.c:2249)
==3649==    by 0x790835: ha_innobase::add_index(st_table*, st_key*, unsigned) (handler0alter.cc:741)
==3649==    by 0x6E1A1F: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
==3649==    by 0x5C25DB: mysql_execute_command(THD*, unsigned long long*) (sql_parse.cc:3148)
==3649==    by 0x5C5BE3: mysql_parse(THD*, char*, unsigned, char const**, unsigned long long*) (sql_parse.cc:6342)
==3649==    by 0x5C6B8B: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1311)
==3649==    by 0x5C7D16: do_command(THD*) (sql_parse.cc:934)
==3649==    by 0x5B596B: handle_one_connection (sql_connect.cc:1184)
==3649==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==3649==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
==3649== 
==3649== 
==3649== 2,528 bytes in 3 blocks are still reachable in loss record 3 of 3
==3649==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==3649==    by 0x7A83FF: mem_heap_create_block (mem0mem.c:333)
==3649==    by 0x7A85C2: mem_heap_add_block (mem0mem.c:446)
==3649==    by 0x7A8A60: mem_heap_alloc (mem0mem.ic:186)
==3649==    by 0x7A8E8B: mem_heap_zalloc (mem0mem.ic:154)
==3649==    by 0x836244: dict_mem_table_create (dict0mem.c:66)
==3649==    by 0x7D17EF: row_merge_create_temporary_table (row0merge.c:2249)
==3649==    by 0x790835: ha_innobase::add_index(st_table*, st_key*, unsigned) (handler0alter.cc:741)
==3649==    by 0x6E1A1F: mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned, st_order*, bool) (sql_table.cc:7328)
==3649==    by 0x5C25DB: mysql_execute_command(THD*, unsigned long long*) (sql_parse.cc:3148)
==3649==    by 0x5C5BE3: mysql_parse(THD*, char*, unsigned, char const**, unsigned long long*) (sql_parse.cc:6342)
==3649==    by 0x5C6B8B: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1311)
==3649==    by 0x5C7D16: do_command(THD*) (sql_parse.cc:934)
==3649==    by 0x5B596B: handle_one_connection (sql_connect.cc:1184)
==3649==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==3649==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
[10 Nov 2010 13:31] Marko Mäkelä
This could be a duplicate of Bug #56947, which should be fixed in 5.1.53.
[30 Nov 2010 20:56] Sveta Smirnova
I can not repeat exactly same error, but get other valgrind warnings like in bug #51792.
[2 Feb 2013 13:58] Shane Bester
cant repeat on 5.5.29.

The servers were restarted 22 times
Spent 582.469 of 861 seconds executing testcases

Completed: All 93 tests were successful.

10 tests were skipped, 6 by the test itself.

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

Page generated in 0.048 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.