[MDEV-2474] LP:609795 - valgrind warnings for innodb in mariadb-5.1.42 Created: 2010-07-25  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Mark Callaghan Assignee: Kristian Nielsen
Resolution: Not a Bug Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug609795.xml    

 Description   

What I think is the latest MariaDB release (mariadb-5.1.42) gets many valgrind warnings from xtradb while running innodb regression tests.

mysqld was built using:
./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,innobase --with-fast-mutexes --with-extra-charsets=all --with-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_purify -Wall"

The server is centos 5.2, gcc 4.1.2, valgrind-3.2.1, 64-bit x86

These warnings occur for most or all of the tests:

==12503== Conditional jump or move depends on uninitialised value(s)
==12503== at 0x7FDD33: rw_lock_x_lock_func (sync0rw.ic:283)
==12503== by 0x7B1358: log_groups_write_checkpoint_info (log0log.c:1871)
==12503== by 0x7B2B1B: log_checkpoint (log0log.c:2069)
==12503== by 0x7B2CC0: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:194)
==12503== by 0x8656C1: fsp_fill_free_list (fsp0fsp.c:1406)
==12503== by 0x86630E: fsp_header_init (fsp0fsp.c:1008)
==12503== by 0x7FC676: innobase_start_or_create_for_mysql (srv0start.c:1507)
==12503== by 0x79887F: innobase_init(void*) (ha_innodb.cc:2417)
==12503== by 0x69D0BD: ha_initialize_handlerton(st_plugin_int*) (handler.cc:434)
==12503== by 0x731E08: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1014)
==12503== by 0x73501A: plugin_init(int*, char**, int) (sql_plugin.cc:1239)
==12503== by 0x5A1984: init_server_components() (mysqld.cc:4069)
==12503== by 0x5A212E: main (mysqld.cc:4541)
==12503==
==12503== Conditional jump or move depends on uninitialised value(s)
==12503== at 0x7FDE80: rw_lock_x_lock_func (sync0rw.c:569)
==12503== by 0x86D916: fseg_create_general (mtr0mtr.ic:268)
==12503== by 0x86E393: fseg_create (fsp0fsp.c:2380)
==12503== by 0x8196ED: btr_create (btr0btr.c:750)
==12503== by 0x86634E: fsp_header_init (fsp0fsp.c:1009)
==12503== by 0x7FC676: innobase_start_or_create_for_mysql (srv0start.c:1507)
==12503== by 0x79887F: innobase_init(void*) (ha_innodb.cc:2417)
==12503== by 0x69D0BD: ha_initialize_handlerton(st_plugin_int*) (handler.cc:434)
==12503== by 0x731E08: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1014)
==12503== by 0x73501A: plugin_init(int*, char**, int) (sql_plugin.cc:1239)
==12503== by 0x5A1984: init_server_components() (mysqld.cc:4069)
==12503== by 0x5A212E: main (mysqld.cc:4541)



 Comments   
Comment by Mark Callaghan [ 2010-07-25 ]

Re: valgrind warnings for innodb in mariadb-5.1.42
For the sync0rw.ic warning, valgrind claims the warning occurs from ut_a(success)
os_compare_and_swap_thread_id expands to __sync_bool_compare_and_swap
It isn't obvious why this has a warning.

local_thread = lock->writer_thread;
success = os_compare_and_swap_thread_id(
&lock->writer_thread, local_thread, curr_thread);
ut_a(success) <---- warning comes from here

output from the preprocessor of one caller:
static _inline_
void
mtr_x_lock_func(

rw_lock_t* lock,
const char* file,
ulint line,
mtr_t* mtr)
{
;
;

rw_lock_x_lock_func(lock, 0, file, line);

.............

void
rw_lock_x_lock_func(

rw_lock_t* lock,
ulint pass,

const char* file_name,
ulint line)
{
ulint index;
ulint i;
ulint spinning = (0);

;

i = 0;

lock_loop:

if (rw_lock_x_lock_low(lock, pass, file_name, line))

{ rw_x_spin_round_count += i; return; }

else {

if (!spinning)

{ spinning = (1); rw_x_spin_wait_count++; }

while (i < srv_n_spin_wait_rounds
&& lock->lock_word <= 0) {
if (srv_spin_wait_delay)

{ ut_delay(ut_rnd_interval(0, srv_spin_wait_delay)); }

i++;
}
if (i == srv_n_spin_wait_rounds)

{ os_thread_yield(); }

else

{ goto lock_loop; }

}

rw_x_spin_round_count += i;

if ((0))

{ fprintf(stderr, "Thread %lu spin wait rw-x-lock at %p" " '%s' rnds %lu\n", os_thread_pf(os_thread_get_curr_id()), (void*) lock, lock->lock_name, (ulong) i); }

sync_array_reserve_cell(sync_primary_wait_array,
lock,
351,
file_name, line,
&index);

rw_lock_set_waiter_flag(lock);

if (rw_lock_x_lock_low(lock, pass, file_name, line))

{ sync_array_free_cell(sync_primary_wait_array, index); return; }

if ((0))

{ fprintf(stderr, "Thread %lu OS wait for rw-x-lock at %p" " '%s'\n", os_thread_pf(os_thread_get_curr_id()), (void*) lock, lock->lock_name); }

lock->count_os_wait++;
rw_x_os_wait_count++;

sync_array_wait_event(sync_primary_wait_array, index);

i = 0;
goto lock_loop;
}

......

tatic _inline_
void
rw_lock_set_writer_id_and_recursion_flag(

rw_lock_t* lock,
ulint recursive)

{
os_thread_id_t curr_thread = os_thread_get_curr_id();

os_thread_id_t local_thread;
ulint success;

do {} while(0);

local_thread = lock->writer_thread;
success = __sync_bool_compare_and_swap(&lock->writer_thread, local_thread, curr_thread);

do { if (__builtin_expect(!((ulint)(success)), (0)))

{ ut_dbg_assertion_failed("success", "./include/sync0rw.ic", (ulint) 283); abort(); }

do {} while (0); } while (0);
lock->recursive = recursive;

  1. 294 "./include/sync0rw.ic"
    }
Comment by Mark Callaghan [ 2010-07-25 ]

Re: valgrind warnings for innodb in mariadb-5.1.42
The other warning comes from the variables checked in the 'if' line.

/* Decrement failed: relock or failed lock */
if (!pass && lock->recursive
&& os_thread_eq(lock->writer_thread, curr_thread))

{ /* Relock */ lock->lock_word -= X_LOCK_DECR; }

else

{ /* Another thread locked before us */ return(FALSE); }
Comment by Mark Callaghan [ 2010-07-25 ]

Re: valgrind warnings for innodb in mariadb-5.1.42
The warnings also occur with non-debug builds

Comment by Mark Callaghan [ 2010-07-25 ]

Re: valgrind warnings for innodb in mariadb-5.1.42
The latest code from bzr for MariaDB 5.2 has the same warnings:

==23433== Conditional jump or move depends on uninitialised value(s)
==23433== at 0x5916158: rw_lock_x_lock_func (sync0rw.ic:283)
==23433== by 0x58BB34F: log_groups_write_checkpoint_info (log0log.c:1876)
==23433== by 0x58BCAE6: log_checkpoint (log0log.c:2074)
==23433== by 0x58BCDFE: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:194)
==23433== by 0x5886C3D: fsp_fill_free_list (fsp0fsp.c:1415)
==23433== by 0x5887A80: fsp_header_init (fsp0fsp.c:1017)
==23433== by 0x5914BE0: innobase_start_or_create_for_mysql (srv0start.c:1509)
==23433== by 0x589BCEB: innobase_init(void*) (ha_innodb.cc:2418)
==23433== by 0x6BB3A3: ha_initialize_handlerton(st_plugin_int*) (handler.cc:430)
==23433== by 0x754576: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1239)
==23433== by 0x757C94: plugin_init(int*, char**, int) (sql_plugin.cc:1467)
==23433== by 0x5AEAAF: init_server_components() (mysqld.cc:4126)
==23433== by 0x5AF399: main (mysqld.cc:4600)
==23433== Conditional jump or move depends on uninitialised value(s)
==23433== at 0x59162C9: rw_lock_x_lock_func (sync0rw.c:569)
==23433== by 0x58915DC: fseg_create_general (mtr0mtr.ic:268)
==23433== by 0x5836C57: btr_create (btr0btr.c:762)
==23433== by 0x5887AB5: fsp_header_init (fsp0fsp.c:1018)
==23433== by 0x5914BE0: innobase_start_or_create_for_mysql (srv0start.c:1509)
==23433== by 0x589BCEB: innobase_init(void*) (ha_innodb.cc:2418)
==23433== by 0x6BB3A3: ha_initialize_handlerton(st_plugin_int*) (handler.cc:430)
==23433== by 0x754576: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1239)
==23433== by 0x757C94: plugin_init(int*, char**, int) (sql_plugin.cc:1467)
==23433== by 0x5AEAAF: init_server_components() (mysqld.cc:4126)
==23433== by 0x5AF399: main (mysqld.cc:4600)

Comment by Mark Callaghan [ 2010-07-27 ]

Re: [Bug 609795] Re: valgrind warnings for innodb in mariadb-5.1.42
See https://bugs.launchpad.net/percona-server/+bug/610531
I think the latest Percona release has the same warnings.

On Tue, Jul 27, 2010 at 12:44 PM, Kristian Nielsen
<knielsen@knielsen-hq.org> wrote:
> ** Changed in: maria
>       Status: New => In Progress
>
> ** Changed in: maria
>     Assignee: (unassigned) => Kristian Nielsen (knielsen)
>
> –
> valgrind warnings for innodb in mariadb-5.1.42
> https://bugs.launchpad.net/bugs/609795
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Maria: In Progress
>
> Bug description:
> What I think is the latest MariaDB release (mariadb-5.1.42) gets many valgrind warnings from xtradb while running innodb regression tests.
>
> mysqld was built using:
> ./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,innobase --with-fast-mutexes --with-extra-charsets=all --with-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_purify -Wall"
>
> The server is centos 5.2, gcc 4.1.2, valgrind-3.2.1, 64-bit x86
>
> These warnings occur for most or all of the tests:
>
> ==12503== Conditional jump or move depends on uninitialised value(s)
> ==12503==    at 0x7FDD33: rw_lock_x_lock_func (sync0rw.ic:283)
> ==12503==    by 0x7B1358: log_groups_write_checkpoint_info (log0log.c:1871)
> ==12503==    by 0x7B2B1B: log_checkpoint (log0log.c:2069)
> ==12503==    by 0x7B2CC0: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:194)
> ==12503==    by 0x8656C1: fsp_fill_free_list (fsp0fsp.c:1406)
> ==12503==    by 0x86630E: fsp_header_init (fsp0fsp.c:1008)
> ==12503==    by 0x7FC676: innobase_start_or_create_for_mysql (srv0start.c:1507)
> ==12503==    by 0x79887F: innobase_init(void*) (ha_innodb.cc:2417)
> ==12503==    by 0x69D0BD: ha_initialize_handlerton(st_plugin_int*) (handler.cc:434)
> ==12503==    by 0x731E08: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1014)
> ==12503==    by 0x73501A: plugin_init(int*, char**, int) (sql_plugin.cc:1239)
> ==12503==    by 0x5A1984: init_server_components() (mysqld.cc:4069)
> ==12503==    by 0x5A212E: main (mysqld.cc:4541)
> ==12503==
> ==12503== Conditional jump or move depends on uninitialised value(s)
> ==12503==    at 0x7FDE80: rw_lock_x_lock_func (sync0rw.c:569)
> ==12503==    by 0x86D916: fseg_create_general (mtr0mtr.ic:268)
> ==12503==    by 0x86E393: fseg_create (fsp0fsp.c:2380)
> ==12503==    by 0x8196ED: btr_create (btr0btr.c:750)
> ==12503==    by 0x86634E: fsp_header_init (fsp0fsp.c:1009)
> ==12503==    by 0x7FC676: innobase_start_or_create_for_mysql (srv0start.c:1507)
> ==12503==    by 0x79887F: innobase_init(void*) (ha_innodb.cc:2417)
> ==12503==    by 0x69D0BD: ha_initialize_handlerton(st_plugin_int*) (handler.cc:434)
> ==12503==    by 0x731E08: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1014)
> ==12503==    by 0x73501A: plugin_init(int*, char**, int) (sql_plugin.cc:1239)
> ==12503==    by 0x5A1984: init_server_components() (mysqld.cc:4069)
> ==12503==    by 0x5A212E: main (mysqld.cc:4541)
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/maria/+bug/609795/+subscribe
>


Mark Callaghan
mdcallag@gmail.com

Comment by Kristian Nielsen [ 2010-07-27 ]

Re: valgrind warnings for innodb in mariadb-5.1.42
Thank you for the bug report!

I was able to reproduce, however the problem here is with the -DHAVE_purify in
the ./configure line.

In MariaDB, this macro was renamed to HAVE_valgrind. So the problem is solved
by instead using this ./configure line:

./configure --enable-thread-safe-client --with-plugins=partition,csv,blackhole,myisam,heap,xtradb --with-fast-mutexes --with-extra-charsets=all --with-debug C_EXTRA_FLAGS="-fno-omit-frame-pointer -fno-strict-aliasing -DHAVE_valgrind -Wall"

And yes, despite the new name making more sense, this rename was in retrospect
probably a bad idea Sorry for the inconvenience.

Comment by Rasmus Johansson (Inactive) [ 2010-07-27 ]

Launchpad bug id: 609795

Generated at Thu Feb 08 06:42:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.