Bug #44186 InnoDB Plugin: Valgrind problems
Submitted: 9 Apr 2009 13:04 Modified: 15 Feb 2011 9:52
Reporter: Calvin Sun Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:1.0.3 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: innodb, plugin, valgrind

[9 Apr 2009 13:04] Calvin Sun
Description:
This is reported by Brian Aker:

We are seeing a lot of messages like this in the current plugin:
==23993== Conditional jump or move depends on uninitialised value(s)
==23993==    at 0x66BB80: rw_lock_x_lock_func (sync0rw.ic:292)
==23993==    by 0x6188C2: log_group_checkpoint (log0log.c:1782)
==23993==    by 0x61A1EF: log_checkpoint (log0log.c:1890)
==23993==    by 0x61A4C6: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:173)
==23993==    by 0x5FCFF1: fsp_fill_free_list (fsp0fsp.c:1378)
==23993==    by 0x6002BE: fsp_header_init (fsp0fsp.c:994)
==23993==    by 0x669AB2: innobase_start_or_create_for_mysql (srv0start.c:1462)
==23993==    by 0x5BBD39: _ZL13innobase_initPv (ha_innodb.cc:2082)
==23993==    by 0x56C812: storage_engine_initializer(st_plugin_int*) (storage_engine.cc:205)
==23993==    by 0x5078F8: _ZL17plugin_initializeP13st_plugin_int (sql_plugin.cc:599)
==23993==    by 0x5094D7: plugin_init(int*, char**, int) (sql_plugin.cc:708)
==23993==    by 0x4168B0: main (drizzled.cc:1562) 

How to repeat:
- install the plugin
- start the server with valgrind
[9 Apr 2009 15:15] Brian Aker
Tracking bug report for Drizzle is:
https://bugs.launchpad.net/drizzle/+bug/358518
[16 Apr 2009 1:10] MySQL Verification Team
Thank you for the bug report. Verified on Slackware 32-bit with latest 5.1 source server.

==2252== 1,774,336 bytes in 117 blocks are still reachable in loss record 7 of 8
==2252==    at 0x4023A29: malloc (vg_replace_malloc.c:207)
==2252==    by 0x84A0609: mem_area_alloc (mem0pool.c:357)
==2252==    by 0x849FA50: mem_heap_create_block (mem0mem.c:352)
==2252==    by 0x849F015: mem_heap_create_func (mem0mem.ic:442)
==2252==    by 0x849F131: mem_alloc_func (mem0mem.ic:527)
==2252==    by 0x848C37B: hash0_create (hash0hash.c:104)
==2252==    by 0x84DD458: thr_local_init (thr0loc.c:241)
==2252==    by 0x84D61B5: srv_general_init (srv0srv.c:974)
==2252==    by 0x84D6833: srv_boot (srv0srv.c:1302)
==2252==    by 0x84D9D67: innobase_start_or_create_for_mysql (srv0start.c:1212)
==2252==    by 0x844F40D: innobase_init(void*) (ha_innodb.cc:2150)
==2252==    by 0x8368EDE: ha_initialize_handlerton(st_plugin_int*) (handler.cc:432)
==2252==
==2252==
==2252== 2,520,435 bytes in 28 blocks are still reachable in loss record 8 of 8
==2252==    at 0x4023A29: malloc (vg_replace_malloc.c:207)
==2252==    by 0x84EE59D: ut_malloc_low (ut0mem.c:97)
==2252==    by 0x84EE830: ut_malloc (ut0mem.c:223)
==2252==    by 0x849FE43: mem_pool_create (mem0pool.c:212)
==2252==    by 0x849F339: mem_init (mem0dbg.c:165)
==2252==    by 0x84D61B0: srv_general_init (srv0srv.c:973)
==2252==    by 0x84D6833: srv_boot (srv0srv.c:1302)
==2252==    by 0x84D9D67: innobase_start_or_create_for_mysql (srv0start.c:1212)
==2252==    by 0x844F40D: innobase_init(void*) (ha_innodb.cc:2150)
==2252==    by 0x8368EDE: ha_initialize_handlerton(st_plugin_int*) (handler.cc:432)
==2252==    by 0x84197CA: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1003)
==2252==    by 0x841D06A: plugin_init(int*, char**, int) (sql_plugin.cc:1216)
[13 Aug 2009 12:39] Marko Mäkelä
Can you repeat this if you build with
#define UNIV_DEBUG_VALGRIND
enabled in storage/innobase/include/univ.i?

It should silence bogus warnings in the atomic memory access code. See this piece of code in storage/innobase/include/sync0rw.ic, in rw_lock_set_writer_id_and_recursion_flag():

	/* Prevent Valgrind warnings about writer_thread being
	uninitialized.  It does not matter if writer_thread is
	uninitialized, because we are comparing writer_thread against
	itself, and the operation should always succeed. */
	UNIV_MEM_VALID(&lock->writer_thread, sizeof lock->writer_thread);
[13 Sep 2009 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".
[15 Feb 2011 9:04] Marko Mäkelä
This is a likely duplicate of Bug #59307. We are comparing x==x with uninitialized x, and Valgrind does not like that.