Bug #59152 Valgrind warning in P_S in release build
Submitted: 24 Dec 2010 8:52 Modified: 5 Jan 2011 11:10
Reporter: Alexander Nozdrin Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S1 (Critical)
Version:5.6.1 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any
Tags: pb2, test failure

[24 Dec 2010 8:52] Alexander Nozdrin
Description:
There are many valgrind warnings like this one:

==15559== 16,448 bytes in 1 blocks are possibly lost in loss record 168 of 184
==15559==    at 0x4C20E1C: malloc (vg_replace_malloc.c:195)
==15559==    by 0x7F7ED1: my_malloc (my_malloc.c:38)
==15559==    by 0x9A7D3E: _lf_dynarray_lvalue (lf_dynarray.c:126)
==15559==    by 0x9A78D3: _lf_pinbox_get_pins (lf_alloc-pin.c:173)
==15559==    by 0x943EA0: insert_setup_object(enum_object_type, String const*, String const*, bool, bool) (lf.h:168)
==15559==    by 0x94FFEE: install_default_setup(PSI_bootstrap*) (pfs_defaults.cc:56)
==15559==    by 0x942F3E: initialize_performance_schema(PFS_global_param const*) (pfs_server.cc:91)
==15559==    by 0x512C0E: mysqld_main(int, char**) (mysqld.cc:4493)
==15559==    by 0x5B26993: (below main) (in /lib64/libc-2.5.so)

How to repeat:
Tree: http://pb2.norway.sun.com/?template=show_pushes&branch=mysql-5.6.1-m5-release

Log: http://pb2.norway.sun.com/?action=archive_download&archive_id=2710734&;
pretty=please
[5 Jan 2011 11:10] Marc ALFF
I think there is something wrong with valgrind itself.

The stack reported is incorrect:
- the function insert_setup_object() is *not* located in lf.h
- what is in lf.h should be lf_pinbox_get_pins()

Note that this specific call stack is already suppressed in valgrind.supp,
with the following:

{
   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
}

The same suppression exists in mysql-5.6-1-m5-release and in mysql-trunk,
yet valgrind fails on mysql-5.6-1-m5-release and succeeds (to suppress the warning) in mysql-trunk.

On an important note, the same host does not seem to be used in PB2 to execute the valgrind tests for these branches.

At this point, I suspect that the version of valgrind deployed on the host used to perform the PB2 valgrind build for mysql-5.6-1-m5-release is broken.

Given that the valgrind build is clean in the main tree, in mysql-trunk, and that the syntax of the suppression pushed in the source code is the correct one, this is not a bug in the source code, including valgrind.supp, but in the environment.

Closing as not a bug.

For mysql-5.6.1-m5-release, please check if the version of valgrind used is up to date.
As a possible work around if valgrind has trouble with inline functions,
the following suppression may work, but this is just speculation:

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

(aka, reduced the stack depth to remove fun:lf_pinbox_get_pins)

See related bug#58707 and Bug#58740.