Bug #55720 valgrind warnings
Submitted: 3 Aug 2010 19:12 Modified: 13 Feb 2012 1:47
Reporter: Oleg Tsarev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:5.1 bzr OS:Any
Assigned to: Sunny Bains CPU Architecture:Any

[3 Aug 2010 19:12] Oleg Tsarev
Description:
https://bugs.launchpad.net/percona-server/+bug/610531+
I built 5.1.47-rel11.2 from source using gcc-4.1.2 on centos-5.2 and 64-bit x86.
There are valgrind warnings from mtr --valgrind --suite=innodb

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

I think these are the same I saw in the MariaDB builds. I don't think these are in official MySQL.

==17041== Conditional jump or move depends on uninitialised value(s)
==17041== at 0x7BEF68: rw_lock_x_lock_func (sync0rw.ic:283)
==17041== by 0x76EF41: log_groups_write_checkpoint_info (log0log.c:1859)
==17041== by 0x770660: log_checkpoint (log0log.c:2057)
==17041== by 0x77096E: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:177)
==17041== by 0x82B729: fsp_fill_free_list (fsp0fsp.c:1417)
==17041== by 0x82C629: fsp_header_init (fsp0fsp.c:1019)
==17041== by 0x7BD412: innobase_start_or_create_for_mysql (srv0start.c:1652)
==17041== by 0x750612: innobase_init(void*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x6AC2D7: ha_initialize_handlerton(st_plugin_int*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x733D36: plugin_initialize(st_plugin_int*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x737300: plugin_init(int*, char**, int) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x5AF4D0: init_server_components() (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x5B2C54: main (in /s/bld/percona-opt/sql/mysqld)
==17041==
==17041== Conditional jump or move depends on uninitialised value(s)
==17041== at 0x7BF0E0: rw_lock_x_lock_func (sync0rw.c:569)
==17041== by 0x835D5A: fseg_create_general (mtr0mtr.ic:271)
==17041== by 0x7DC92C: btr_create (btr0btr.c:768)
==17041== by 0x82C658: fsp_header_init (fsp0fsp.c:1020)
==17041== by 0x7BD412: innobase_start_or_create_for_mysql (srv0start.c:1652)
==17041== by 0x750612: innobase_init(void*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x6AC2D7: ha_initialize_handlerton(st_plugin_int*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x733D36: plugin_initialize(st_plugin_int*) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x737300: plugin_init(int*, char**, int) (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x5AF4D0: init_server_components() (in /s/bld/percona-opt/sql/mysqld)
==17041== by 0x5B2C54: main (in /s/bld/percona-opt/sql/mysqld)

There are also bogus warnings when compiling in debug mode with -DHAVE_purify. These will be fixed in a future MySQL release:

==13890== Uninitialised byte(s) found during client check request
==13890== at 0x839757: buf_page_get_gen (buf0buf.ic:976)
==13890== by 0x86D528: fsp_header_init (fsp0fsp.c:989)
==13890== by 0x7EF192: innobase_start_or_create_for_mysql (srv0start.c:1652)
==13890== by 0x772CD5: innobase_init(void*) (ha_innodb.cc:2421)
==13890== by 0x6B0C9F: ha_initialize_handlerton(st_plugin_int*) (handler.cc:435)
==13890== by 0x74FBEF: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1019)
==13890== by 0x752FDB: plugin_init(int*, char**, int) (sql_plugin.cc:1246)
==13890== by 0x5A3331: init_server_components() (mysqld.cc:3983)
==13890== by 0x5A779D: main (mysqld.cc:4460)
==13890== Address 0x6474CBC is not stack'd, malloc'd or (recently) free'd
./include/buf0buf.ic:976: 0x6474cb0[144] undefined at 12
==13890==
==13890== Uninitialised byte(s) found during client check request
==13890== at 0x839514: buf_page_get_gen (buf0buf.c:2511)
==13890== by 0x86D528: fsp_header_init (fsp0fsp.c:989)
==13890== by 0x7EF192: innobase_start_or_create_for_mysql (srv0start.c:1652)
==13890== by 0x772CD5: innobase_init(void*) (ha_innodb.cc:2421)
==13890== by 0x6B0C9F: ha_initialize_handlerton(st_plugin_int*) (handler.cc:435)
==13890== by 0x74FBEF: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1019)
==13890== by 0x752FDB: plugin_init(int*, char**, int) (sql_plugin.cc:1246)
==13890== by 0x5A3331: init_server_components() (mysqld.cc:3983)
==13890== by 0x5A779D: main (mysqld.cc:4460)
==13890== Address 0x6474CBC is not stack'd, malloc'd or (recently) free'd
buf/buf0buf.c:2511: 0x6474cb0[144] undefined at 12

How to repeat:
get upstream mysql5.1.49
get patch innodb_swap_builtin_plugin.patch

tar zxf mysql-5.1.49.tar.gz
cd mysq-5.1.49
cat ../innodb_swap_builtin_plugin.patch | patch -p1
export CFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2"
export CXXFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2"
export LIBS=-lrt
./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,innodb_plugin --without-plugin-innobase --with-fast-mutexes --with-extra-charsets=all --without-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -Wall"
make
cd mysql-test
./mysql-test-run --valgrind --suite=innodb
[3 Aug 2010 19:13] Oleg Tsarev
swap built-in plugin

Attachment: innodb_swap_builtin_plugin.patch (text/x-patch), 8.46 KiB.

[3 Aug 2010 19:48] MySQL Verification Team
Thank you for the bug report. Your repeat instructions:

get patch innodb_swap_builtin_plugin.patch

from where to get the above source?. Thanks in advance.
[3 Aug 2010 23:23] Oleg Tsarev
Miguel,

Just use upstream  mysql-5.1.49.tar.gz and patch from attachments.

Best regards, Oleg
[4 Aug 2010 6:52] Sveta Smirnova
Thank you for the feedback.

I get warnings with and without patch, but I am not sure if this is case you are reporting. Please upload full log from your environment.
[4 Aug 2010 8:44] Oleg Tsarev
Sveta,

I think, this patch doesn't required for reproduce bug - originally this bug to Percona-Server.
I excude all patches instead one, and this problem was reproduced already.
I don't exclude last patch, because this patch required for static build innodb_plugin.

Best regards, Oleg.
[4 Aug 2010 8:53] Oleg Tsarev
Sveta,

I think, this patch isn't required to reproduce bug - originally this bug was assigned to Percona-Server.
I revert all Percona's patches excluding one, and this problem was already reproduced .
I didn't revert last patch, because this patch is required for static innodb_plugin build.

Best regards, Oleg.
[4 Aug 2010 9:28] Sveta Smirnova
Oleg,

please send full log from test run anyway: I want to check which test[s] exactly fails.
[4 Aug 2010 9:35] Oleg Tsarev
tsarev@main:/storage/project/percona/bug610531$ cat do.sh
#!/usr/bin/env sh
rm -rf mysql-5.1.49
tar zxf mysql-5.1.49.tar.gz
cd mysql-5.1.49
cat ../innodb_swap_builtin_plugin.patch | patch -p1
export CFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2"
export CXXFLAGS="-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2"
export LIBS=-lrt
./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,innodb_plugin --without-plugin-innobase --with-fast-mutexes --with-extra-charsets=all --without-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -Wall"
make -j5
cd mysql-test
./mysql-test-run --valgrind --suite=innodb
tsarev@main:/storage/project/percona/bug610531$ ./do.sh
patching file configure
patching file mysql-test/include/have_innodb_plugin.inc
patching file mysql-test/include/read_many_rows.inc
patching file mysql-test/lib/mtr_cases.pm
patching file mysql-test/r/read_many_rows_innodb.result
patching file storage/innobase/plug.in
patching file storage/innodb_plugin/plug.in
configure: WARNING: unrecognized options: --without-plugin-innobase
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
.........................................................
libtool: link: g++ -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-omit-frame-pointer -fno-strict-aliasing -Wall -fno-implicit-templates -fno-exceptions -fno-rtti -rdynamic -o mysqlmanager mysqlmanager-command.o mysqlmanager-mysqlmanager.o mysqlmanager-manager.o mysqlmanager-log.o mysqlmanager-thread_registry.o mysqlmanager-listener.o mysqlmanager-protocol.o mysqlmanager-mysql_connection.o mysqlmanager-user_map.o mysqlmanager-messages.o mysqlmanager-commands.o mysqlmanager-instance.o mysqlmanager-instance_map.o mysqlmanager-instance_options.o mysqlmanager-buffer.o mysqlmanager-parse.o mysqlmanager-guardian.o mysqlmanager-parse_output.o mysqlmanager-user_management_commands.o mysqlmanager-angel.o  ./.libs/liboptions.a -lpthread -lpthread -lpthread -lpthread libnet.a ../../vio/libvio.a ../../mysys/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a ../../zlib/.libs/libzlt.a -lpthread -lcrypt -lnsl -lm -lrt -lpthread
make[2]: Leaving directory `/storage/project/percona/bug610531/mysql-5.1.49/server-tools/instance-manager'
make[1]: Leaving directory `/storage/project/percona/bug610531/mysql-5.1.49/server-tools'
Making all in win
make[1]: Entering directory `/storage/project/percona/bug610531/mysql-5.1.49/win'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/storage/project/percona/bug610531/mysql-5.1.49/win'
Logging: ./mysql-test-run  --valgrind --suite=innodb
MySQL Version 5.1.49
Turning on valgrind for all executables
Running valgrind with options " --show-reachable=yes "
Checking supported features...
 - skipping ndbcluster, mysqld not compiled with ndbcluster
 - skipping SSL, mysqld not compiled with SSL
Using "../libtool" when running valgrind or debugger
Collecting tests...
vardir: /storage/project/percona/bug610531/mysql-5.1.49/mysql-test/var
Removing old var directory...
Creating var directory '/storage/project/percona/bug610531/mysql-5.1.49/mysql-test/var'...
Installing system database...
Using server port 42314

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
innodb.innodb_bug53674                   [ fail ]  Found warnings/errors in server log file!
        Test ended at 2010-08-04 13:34:31
line
==5171== Conditional jump or move depends on uninitialised value(s)
==5171==    at 0x7831B5: rw_lock_x_lock_func (sync0rw.ic:283)
==5171==    by 0x7E4D39: fsp_header_init (mtr0mtr.ic:271)
==5171==    by 0x781BE8: innobase_start_or_create_for_mysql (srv0start.c:1491)
==5171==    by 0x7198C7: innobase_init(void*) (ha_innodb.cc:2250)
==5171==    by 0x6831F7: ha_initialize_handlerton(st_plugin_int*) (handler.cc:435)
==5171==    by 0x702196: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1019)
==5171==    by 0x704353: plugin_init(int*, char**, int) (sql_plugin.cc:1246)
==5171==    by 0x5A728D: init_server_components() (mysqld.cc:3998)
==5171==    by 0x5A980D: main (mysqld.cc:4469)
==5171== Conditional jump or move depends on uninitialised value(s)
==5171==    at 0x7831B5: rw_lock_x_lock_func (sync0rw.ic:283)
==5171==    by 0x73580A: log_groups_write_checkpoint_info (log0log.c:1827)
==5171==    by 0x73795F: log_checkpoint (log0log.c:2025)
==5171==    by 0x73845E: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:177)
==5171==    by 0x7E34DA: fsp_fill_free_list (fsp0fsp.c:1402)
==5171==    by 0x7E527E: fsp_header_init (fsp0fsp.c:1004)
==5171==    by 0x781BE8: innobase_start_or_create_for_mysql (srv0start.c:1491)
==5171==    by 0x7198C7: innobase_init(void*) (ha_innodb.cc:2250)
==5171==    by 0x6831F7: ha_initialize_handlerton(st_plugin_int*) (handler.cc:435)
==5171==    by 0x702196: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1019)
==5171==    by 0x704353: plugin_init(int*, char**, int) (sql_plugin.cc:1246)
==5171==    by 0x5A728D: init_server_components() (mysqld.cc:3998)
==5171==    by 0x5A980D: main (mysqld.cc:4469)
==5171== Conditional jump or move depends on uninitialised value(s)
==5171==    at 0x7831B5: rw_lock_x_lock_func (sync0rw.ic:283)
==5171==    by 0x7B3880: btr_search_check_free_space_in_heap (btr0sea.c:145)
==5171==    by 0x7B39B3: btr_search_update_hash_on_insert (btr0sea.c:1609)
==5171==    by 0x7AC4BD: btr_cur_optimistic_insert (btr0cur.c:1242)
==5171==    by 0x75FA1E: row_ins_index_entry_low (row0ins.c:2099)
==5171==    by 0x7608B6: row_ins_index_entry (row0ins.c:2179)
==5171==    by 0x760CF9: row_ins_step (row0ins.c:2264)
==5171==    by 0x758507: que_run_threads (que0que.c:1225)
==5171==    by 0x7588F2: que_eval_sql (que0que.c:1431)
==5171==    by 0x7C79CC: dict_create_or_check_foreign_constraint_tables (dict0crea.c:1256)
==5171==    by 0x78181D: innobase_start_or_create_for_mysql (srv0start.c:1672)
==5171==    by 0x7198C7: innobase_init(void*) (ha_innodb.cc:2250)
==5171==    by 0x6831F7: ha_initialize_handlerton(st_plugin_int*) (handler.cc:435)
==5171==    by 0x702196: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1019)
==5171==    by 0x704353: plugin_init(int*, char**, int) (sql_plugin.cc:1246)
==5171==    by 0x5A728D: init_server_components() (mysqld.cc:3998)
==5171== Thread 15:
==5171== Conditional jump or move depends on uninitialised value(s)
==5171==    at 0x7831B5: rw_lock_x_lock_func (sync0rw.ic:283)
==5171==    by 0x7867E9: trx_purge (trx0purge.c:1107)
==5171==    by 0x77E8B5: srv_master_thread (srv0srv.c:2685)
==5171==    by 0x4E349C9: start_thread (pthread_create.c:300)
==5171==    by 0x613E6FC: clone (clone.S:112)
^ Found warnings in /storage/project/percona/bug610531/mysql-5.1.49/mysql-test/var/log/mysqld.1.err
ok

 - saving '/storage/project/percona/bug610531/mysql-5.1.49/mysql-test/var/log/innodb.innodb_bug53674/' to '/storage/project/percona/bug610531/mysql-5.1.49/mysql-test/var/log/innodb.innodb_bug53674/'

Only  1  of 40 completed.
mysql-test-run: *** ERROR: Not all tests completed
tsarev@main:/storage/project/percona/bug610531$
[4 Aug 2010 9:37] Oleg Tsarev
./mysql-test-run --valgrind --suite=innodbtsarev@main:/storage/project/percona/bug610531$ g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

tsarev@main:/storage/project/percona/bug610531$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

tsarev@main:/storage/project/percona/bug610531$ valgrind --version
valgrind-3.6.0.SVN-Debian
tsarev@main:/storage/project/percona/bug610531$ cat /etc/issue
Ubuntu 10.04.1 LTS \n \l

tsarev@main:/storage/project/percona/bug610531$ uname -a
Linux main 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:20:59 UTC 2010 x86_64 GNU/Linux
[4 Aug 2010 10:20] Sveta Smirnova
Thank you for the feedback.

Verified as described with regular BZR 5.1-main tree and innodb_plugin suite. Test innodb_bug53674 fails as described.
[15 Feb 2011 9:06] Marko Mäkelä
The bogus warning in rw_lock_x_lock_func() is a duplicate of Bug #59307. We are comparing x==x with uninitialized x.