Bug #30692 valgrind stack in rpl_ndb_innodb2ndb test
Submitted: 29 Aug 2007 13:18 Modified: 3 Sep 2007 16:42
Reporter: Rafal Somla Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.22 OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any

[29 Aug 2007 13:18] Rafal Somla
Description:
Valgrind reports the following problem:

VALGRIND: 'Conditional jump or move depends on uninitialised value(s)'
    COUNT: 2
    FUNCTION: compare_record(st_table*)    FILES:    master.err
    TESTS:    rpl_ndb.rpl_ndb_innodb2ndb
    STACK: at 0x6C1FF9: compare_record(st_table*) (sql_update.cc:34)
             by 0x6C2EF1: mysql_update(THD*, TABLE_LIST*, List<Item>&,
                                       List<Item>&, Item*, unsigned, st_order*,
                                       unsigned long long, enum_duplicates,
                                       bool) (sql_update.cc:583)
             by 0x63B097: mysql_execute_command(THD*) (sql_parse.cc:2626)
             by 0x63D473: mysql_parse(THD*, char const*, unsigned, char const**)
                                                      (sql_parse.cc:5446)
             by 0x63DDD4: dispatch_command(enum_server_command, THD*, char*,
                                           unsigned) (sql_parse.cc:953)
             by 0x63F16C: do_command(THD*) (sql_parse.cc:712)
             by 0x62F912: handle_one_connection (sql_connect.cc:1099)
             by 0x4B2A192: start_thread (in /lib64/libpthread-2.4.so)
             by 0x51A145C: clone (in /lib64/libc-2.4.so)

Looking at the code we see that valgrind complains about this place:

bool compare_record(TABLE *table)
{
  if (table->s->blob_fields + table->s->varchar_fields == 0)
    return cmp_record(table,record[1]);
  /* Compare null bits */
  if (memcmp(table->null_flags,                <------- HERE
         table->null_flags+table->s->rec_buff_length,
         table->s->null_bytes))
    return TRUE;                // Diff in NULL value
  /* Compare updated fields */
  for (Field **ptr= table->field ; *ptr ; ptr++)

It seems that table->null_flags or table->s->null_bytes is not initialized.

Notes:

1. The problem started to appear regularly after enabling rpl_ndb_innodb2ndb test (before test was disabled).

2. The stack shows that it happens during normal query execution (on master) and 
has probably nothing to do with replication.

How to repeat:
See pb for 5.1-target-5.1.22 or run this test in valgrind mode.