Bug #24403 valgrind complained on uninited st_table, rbr + innodb
Submitted: 17 Nov 2006 18:45 Modified: 22 Nov 2006 8:41
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.14 OS:Linux (Linux)
Assigned to: Andrei Elkin CPU Architecture:Any

[17 Nov 2006 18:45] Andrei Elkin
Description:
The following stack

==7509== Conditional jump or move depends on uninitialised value(s)
==7509==    at 0x8430DFF: calc_row_difference(upd_struct*, char*, char*, st_table*, char*, unsigned long, row_prebuilt_struct*, THD*) (ha_innodb.cc:3603)
==7509==    by 0x84310DF: ha_innobase::update_row(char const*, char*) (ha_innodb.cc:3692)
==7509==    by 0x8346640: handler::ha_update_row(char const*, char*) (handler.cc:3665)
==7509==    by 0x830717F: Update_rows_log_event::do_exec_row(st_table*) (log_event.cc:7178)
==7509==    by 0x8303200: Rows_log_event::exec_event(st_relay_log_info*) (log_event.cc:5757)
==7509==    by 0x83C56BA: exec_relay_log_event(THD*, st_relay_log_info*) (slave.cc:1794)
==7509==    by 0x83C5FEA: handle_slave_sql (slave.cc:2347)
==7509==    by 0x1B934380: start_thread (in /lib/tls/i686/cmov/libpthread-2.3.5.so)
=

was caused by lack of initialization of memory allocated for st_table * table.

How to repeat:
BUILD/compile-pentium-valgrind-max
cd mysql-test
./mysql-test-run t/rpl_row_basic_3innodb.test
cat var/log/slave.err

Suggested fix:
in the patch.
[17 Nov 2006 18:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/15515

ChangeSet@1.2367, 2006-11-17 21:47:40+02:00, aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi +1 -0
  Bug #24403  	valgrind complained on uninited st_table, rbr + innodb
  
  open_table_from_share did not initialize table->record members. that was
  interpreted as the error by valgrind.
  
  Fixed with bzero-ing the members if compilation with -DHAVE_purify.
[17 Nov 2006 20:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/15525

ChangeSet@1.2367, 2006-11-17 23:44:14+02:00, aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi +1 -0
  Bug #24403 valgrind complained on uninited st_table, rbr + innodb
    
    open_table_from_share did not initialize table->record members. that was
    interpreted as the error by valgrind.
    
    Fixed with bzero-ing the members if compilation with -DHAVE_purify.
[20 Nov 2006 20:28] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/15575

ChangeSet@1.2367, 2006-11-20 21:27:39+01:00, mats@romeo.(none) +1 -0
  BUG#24403 (valgrind complained on uninited st_table for InnoDB and RBR):
  Fix to correct behaviour of find_and_fetch_row() for tables that have primary keys stored
  in storage engines that support the fast method to fetch rows given a primary key. The
  method uses position() to retrieve the key for a given record and rnd_pos() to position
  the internal "cursor" at the row. Rnd_pos() returns the found record in table->record[0],
  so the record has to be moved to table->record[1] for further processing after calling
  find_and_fetch_row().
[21 Nov 2006 12:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/15622

ChangeSet@1.2370, 2006-11-21 13:57:52+01:00, mats@romeo.(none) +3 -0
  BUG#24403 (valgrind complaint on uninited st_table for innodb + rbr):
  Removing DBUG_DUMP printouts for valgrind builds since they trigger warnings.
  Removing valgrind memory checks completely.
  Removing bzero() of record when opening table that was added earlier.