Bug #58740 Valgrind warning in PFS (pfs_setup_actor.cc)
Submitted: 5 Dec 2010 12:34 Modified: 9 Feb 2011 16:23
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S1 (Critical)
Version:5.6 (Erica) OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: pb2, test failure

[5 Dec 2010 12:34] Alexander Nozdrin
Description:
rpl.rpl_server_uuid [ fail ] Found warnings/errors in server log file!
        Test ended at 2010-12-03 19:11:50
line
==19390== 84,336 bytes in 289 blocks are still reachable in loss record 7 of 9
==19390==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
==19390==    by 0x900720: my_malloc (my_malloc.c:38)
==19390==    by 0xAF0301: _lf_dynarray_lvalue (lf_dynarray.c:126)
==19390==    by 0xAEF684: _lf_pinbox_get_pins (lf_alloc-pin.c:173)
==19390==    by 0x918B0A: lf_pinbox_get_pins (lf.h:168)
==19390==    by 0x918B5B: get_setup_actor_hash_pins(PFS_thread*) (pfs_setup_actor.cc:117)
==19390==    by 0x919247: insert_setup_actor(String const*, String const*, String const*) (pfs_setup_actor.cc:154)
==19390==    by 0x92C1FF: install_default_setup(PSI_bootstrap*) (pfs_defaults.cc:46)
==19390==    by 0x918A81: initialize_performance_schema(PFS_global_param const*) (pfs_server.cc:91)
==19390==    by 0x553B4D: mysqld_main(int, char**) (mysqld.cc:4487)
==19390==    by 0x547622: main (main.cc:24)

Valgrind: 3.2.1

How to repeat:
Check out PB (trunk-bugfixing).
[8 Dec 2010 5:54] Marc ALFF
Caused by Bug#56666

Resolved by adding this suppression while waiting for the bug fix:

{
   missing shutdown_performance_schema 4
   Memcheck:Leak
   fun:malloc
   fun:my_malloc
   fun:_lf_dynarray_lvalue
   fun:_lf_pinbox_get_pins
   fun:lf_pinbox_get_pins
}

{
   missing shutdown_performance_schema 5
   Memcheck:Leak
   fun:malloc
   fun:my_malloc
   fun:_lf_dynarray_lvalue
   fun:lf_hash_insert
}

{
   missing shutdown_performance_schema 6
   Memcheck:Leak
   fun:malloc
   fun:my_malloc
   fun:_lf_dynarray_lvalue
   fun:lf_hash_delete
}

{
   missing shutdown_performance_schema 7
   Memcheck:Leak
   fun:malloc
   fun:my_malloc
   fun:_lf_dynarray_lvalue
   fun:lf_hash_search
}
[8 Dec 2010 5:55] Marc ALFF
Fixed in mysql-trunk-bugteam
[4 Jan 2011 6:49] Marc ALFF
Merged in mysql-trunk (5.6.2)

Doc team:
Work around only in valgrind.supp, nothing to document.
[5 Jan 2011 14:03] Paul DuBois
No changelog entry needed.
[27 Jan 2011 11:02] Luis Soares
I can still see this in daily-trunk:

main.plugin_auth                         w4 [ fail ]  Found warnings/errors in server log file!
        Test ended at 2011-01-27 00:45:20
line
==6099== 16,448 bytes in 1 blocks are possibly lost in loss record 168 of 184
==6099==    at 0x4C216FB: malloc (vg_replace_malloc.c:236)
==6099==    by 0x85D13B: my_malloc (my_malloc.c:38)
==6099==    by 0xA9EE2D: _lf_dynarray_lvalue (lf_dynarray.c:126)
==6099==    by 0xA9E806: _lf_pinbox_get_pins (lf_alloc-pin.c:173)
==6099==    by 0xA6FBDA: get_setup_actor_hash_pins(PFS_thread*) (lf.h:168)
==6099==    by 0xA6FFF0: insert_setup_actor(String const*, String const*, String const*) (pfs_setup_actor.cc:154)
==6099==    by 0xA80050: install_default_setup(PSI_bootstrap*) (pfs_defaults.cc:46)
==6099==    by 0xA6FB52: initialize_performance_schema(PFS_global_param const*) (pfs_server.cc:91)
==6099==    by 0x51C90A: mysqld_main(int, char**) (mysqld.cc:4496)
==6099==    by 0x510D80: main (main.cc:24)
==6099== 16,448 bytes in 1 blocks are possibly lost in loss record 169 of 184
==6099==    at 0x4C216FB: malloc (vg_replace_malloc.c:236)
==6099==    by 0x85D13B: my_malloc (my_malloc.c:38)
==6099==    by 0xA9EE2D: _lf_dynarray_lvalue (lf_dynarray.c:126)
==6099==    by 0xA9E806: _lf_pinbox_get_pins (lf_alloc-pin.c:173)
==6099==    by 0xA704C8: get_setup_object_hash_pins(PFS_thread*) (lf.h:168)
==6099==    by 0xA7085D: insert_setup_object(enum_object_type, String const*, String const*, bool, bool) (pfs_setup_object.cc:156)
==6099==    by 0xA800AE: install_default_setup(PSI_bootstrap*) (pfs_defaults.cc:56)
==6099==    by 0xA6FB52: initialize_performance_schema(PFS_global_param const*) (pfs_server.cc:91)
==6099==    by 0x51C90A: mysqld_main(int, char**) (mysqld.cc:4496)
==6099==    by 0x510D80: main (main.cc:24)
==6099== 16,448 bytes in 1 blocks are possibly lost in loss record 170 of 184
==6099==    at 0x4C216FB: malloc (vg_replace_malloc.c:236)
==6099==    by 0x85D13B: my_malloc (my_malloc.c:38)
==6099==    by 0xA9EE2D: _lf_dynarray_lvalue (lf_dynarray.c:126)
==6099==    by 0xA9E806: _lf_pinbox_get_pins (lf_alloc-pin.c:173)
==6099==    by 0xA6E87E: get_table_share_hash_pins(PFS_thread*) (lf.h:168)
==6099==    by 0xA6F194: find_or_create_table_share(PFS_thread*, bool, TABLE_SHARE const*) (pfs_instr_class.cc:840)
==6099==    by 0xA7D69F: get_table_share_v1 (pfs.cc:1206)
==6099==    by 0x543389: get_table_share(THD*, TABLE_LIST*, char*, unsigned int, unsigned int, int*, unsigned int) (sql_base.cc:555)
==6099==    by 0x54CD25: open_table(THD*, TABLE_LIST*, st_mem_root*, Open_table_context*) (sql_base.cc:623)
==6099==    by 0x54DE34: open_and_process_table(THD*, LEX*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*, st_mem_root*) (sql_base.cc:4374)
==6099==    by 0x54F08A: open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) (sql_base.cc:4814)
==6099==    by 0x54F590: open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) (sql_base.cc:5411)
==6099==    by 0x59F48C: plugin_init(int*, char**, int) (sql_base.h:482)
==6099==    by 0x51955B: init_server_components() (mysqld.cc:4112)
==6099==    by 0x51CC98: mysqld_main(int, char**) (mysqld.cc:4675)
==6099==    by 0x510D80: main (main.cc:24)

The following tests are affected:
- rpl.rpl_change_master_crash_safe
- rpl.rpl_get_master_version_and_clock
- rpl.rpl_change_master
- rpl.rpl_binlog_errors
- rpl.rpl_server_uuid
- main.plugin_auth
- binlog.binlog_max_extension
- rpl.rpl_heartbeat_basic

I believe that all these tests share one common thing: they all 
restart mysqld(s) in the MTR test by using:

  --source include/restart_mysqld.inc

or by using

  --source include/rpl_restart_server.inc

or with some other approach.

See binary-release-community_rhel5-x86-64bit-valgrind_tar-gz
in http://pb2.norway.sun.com/?template=push_details&push=1962667
[27 Jan 2011 11:12] Anitha Gopi
Re opening since the problem is seen on daily-trunk
[4 Feb 2011 15:27] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:marc.alff@oracle.com-20110204152630-czusj058w6ltwz7i) (version source revid:marc.alff@oracle.com-20110204152630-czusj058w6ltwz7i) (merge vers: 5.5.10) (pib:24)
[4 Feb 2011 15:31] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:marc.alff@oracle.com-20110204153051-qnd9c3mdfv2q62a4) (version source revid:marc.alff@oracle.com-20110204153051-qnd9c3mdfv2q62a4) (merge vers: 5.6.2) (pib:24)
[4 Feb 2011 15:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/130450

3302 Marc Alff	2011-02-04
      Bug#58740 Valgrind warning in PFS (pfs_setup_actor.cc)
      
      Valgrind gets confused by the call stack generated with optimized
      builds, with inlined functions.
      Reduced the stack context for the suppression in lf_pinbox_get_pins.