Bug #51792 Valgrind warnings if InnoDB engine used.
Submitted: 6 Mar 2010 10:40 Modified: 27 Jul 2010 17:49
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.1, 5.5.99 OS:Any
Assigned to: Marko Mäkelä CPU Architecture:Any

[6 Mar 2010 10:40] Sveta Smirnova
Description:
If run easy test which only includes InnoDB valgrind reports nwarnings following. Trace is for next-mr, in 5.1 it looks a bit different.

==14543== Conditional jump or move depends on uninitialised value(s)
==14543==    at 0x85707D: rw_lock_set_writer_id_and_recursion_flag (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857B11: rw_lock_x_lock_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857BF7: rw_lock_x_lock_func (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8D257C: mtr_x_lock_func (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8AA514: fsp_header_init (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x855772: innobase_start_or_create_for_mysql (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x826189: innobase_init(void*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x6DD8F9: ha_initialize_handlerton(st_plugin_int*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x5A8588: plugin_initialize(st_plugin_int*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x5A8E30: plugin_init(int*, char**, int) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x51D49C: init_server_components() (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x51DF11: mysqld_main(int, char**) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x518283: main (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543== Conditional jump or move depends on uninitialised value(s)
==14543==    at 0x85707D: rw_lock_set_writer_id_and_recursion_flag (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857B11: rw_lock_x_lock_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857BF7: rw_lock_x_lock_func (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8C8341: log_group_checkpoint (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8C848C: log_groups_write_checkpoint_info (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8C8604: log_checkpoint (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8C60A9: log_fsp_current_free_limit_set_and_checkpoint (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8AB1FC: fsp_fill_free_list (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8AA7BD: fsp_header_init (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x855772: innobase_start_or_create_for_mysql (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x826189: innobase_init(void*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x6DD8F9: ha_initialize_handlerton(st_plugin_int*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x5A8588: plugin_initialize(st_plugin_int*) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x5A8E30: plugin_init(int*, char**, int) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x51D49C: init_server_components() (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x51DF11: mysqld_main(int, char**) (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543== Conditional jump or move depends on uninitialised value(s)
==14543==    at 0x85707D: rw_lock_set_writer_id_and_recursion_flag (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857B11: rw_lock_x_lock_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857BF7: rw_lock_x_lock_func (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x87EAF6: btr_search_check_free_space_in_heap (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x881421: btr_search_update_hash_on_insert (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x877484: btr_cur_optimistic_insert (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8EE614: row_ins_index_entry_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8EE8B9: row_ins_index_entry (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8EEAFC: row_ins_index_entry_step (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8EED45: row_ins (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8EEF46: row_ins_step (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8E8FFD: que_thr_step (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8E929B: que_run_threads_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8E93AE: que_run_threads (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x8E95A3: que_eval_sql (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x894ADD: dict_create_or_check_foreign_constraint_tables (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543== Thread 10:
==14543== Conditional jump or move depends on uninitialised value(s)
==14543==    at 0x85707D: rw_lock_set_writer_id_and_recursion_flag (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857B11: rw_lock_x_lock_low (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x857BF7: rw_lock_x_lock_func (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x85C7B8: trx_purge (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x853618: srv_master_thread (in /users/ssmirnova/blade12/src/mysql-next-mr/sql/mysqld)
==14543==    by 0x3429E061B4: start_thread (in /lib64/libpthread-2.5.so)
==14543==    by 0x34292CD39C: clone (in /lib64/libc-2.5.so)
^ Found warnings in /users/ssmirnova/blade12/src/mysql-next-mr/mysql-test/var/log/mysqld.1.err
ok

How to repeat:
$cat t/bug50632.test 
--source include/have_innodb.inc
#--source include/have_partition.inc

--disable_query_log

--enable_query_log

select 1;
[8 Mar 2010 13:04] Marko Mäkelä
Did you enable UNIV_DEBUG_VALGRIND? If not, this may be a known bogus warning for the rw-lock code that uses GCC built-in operations for atomic memory access.
[8 Apr 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[9 Apr 2010 6:54] Sveta Smirnova
Marko,

sorry for delay.

Just tested with UNIV_DEBUG_VALGRIND, no errors. Set back to "Verified", because is better to "Verified" as it is better if you decide if this is bug or not.
[19 Apr 2010 13:05] Marko Mäkelä
mysql-5.1-innodb r3403 now defines UNIV_DEBUG_VALGRIND when HAVE_purify is defined.
[27 Jul 2010 17:49] Vasil Dimov
Fixed in:

revno: 3473.1.1
revision-id: marko.makela@oracle.com-20100520104042-ma2nsscqdvwoph8k
parent: marko.makela@oracle.com-20100519081618-h38q02qxuvcowbtk
committer: Marko M?kel? <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Thu 2010-05-20 13:40:42 +0300
message:
  Bug#53593: Add some instrumentation to improve Valgrind sensitivity
  
  BUILD/*: Add valgrind_configs=--with-valgrind.
  BUILD/*: Remove -USAFEMALLOC from valgrind_flags.
  
  configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.
  
  include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
  include/my_sys.h: Make TRASH do MEM_UNDEFINED().
  
  include/m_string.h: Remove unused macro bzero_if_purify(A,B).
  
  _mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.
  
  _myfree(): Declare MEM_NOACCESS() on the freed memory.
  
  storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
  HAVE_VALGRIND rather than HAVE_purify.
  
  Possible things to do:
   * In my_global.h, remove the defined(HAVE_purify) condition
     from the _WIN32 uint3korr().
   * In my_global.h *int*korr(), use | instead of +
     in order to keep the Valgrind V bits accurate
   * Consider replacing HAVE_purify with HAVE_VALGRIND
   * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
[15 Feb 2011 9:02] Marko Mäkelä
Valgrind does not like our innocent x==x comparison with uninitialized x, unless the Valgrind instrumentation in InnoDB is enabled. I have submitted a fix for this in Bug #59307.