Bug #57508 uninitialised value when calling master_pos_wait with numeric argument
Submitted: 18 Oct 2010 7:20 Modified: 24 Oct 2010 10:37
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1.53-debug OS:Linux (FC13 x64)
Assigned to: CPU Architecture:Any
Tags: master_pos_wait, valgrind

[18 Oct 2010 7:20] Shane Bester
Description:
5.1.53 valgrind output:

Conditional jump or move depends on uninitialised value(s)
at: String::c_ptr (sql_string.h:105)
by: Relay_log_info::wait_for_pos (rpl_rli.cc:657)
by: Item_master_pos_wait::val_int (item_func.cc:3372)
by: Item_int_func::val_str (item_func.cc:625)
by: Item_func_concat_ws::val_str (item_strfunc.cc:659)
by: Item::send (item.cc:5576)
by: select_send::send_data (sql_class.cc:1691)
by: end_send_group (sql_select.cc:12425)
by: do_select (sql_select.cc:11147)
by: JOIN::exec (sql_select.cc:2331)
by: mysql_select (sql_select.cc:2534)
by: handle_select (sql_select.cc:269)
by: execute_sqlcom_select (sql_parse.cc:5127)
by: mysql_execute_command (sql_parse.cc:2292)
by: mysql_parse (sql_parse.cc:6051)
by: dispatch_command (sql_parse.cc:1260)
by: do_command (sql_parse.cc:888)
by: handle_one_connection (sql_connect.cc:1136)
by: start_thread (pthread_create.c:301)

The offending code is only in debug builds:

DBUG_PRINT("enter",("log_name: '%s'  log_pos: %lu  timeout: %lu",
           log_name->c_ptr(), (ulong) log_pos, (ulong) timeout));

How to repeat:
run debug build of mysqld in valgrind:

valgrind -v --leak-check=full --show-reachable=yes --db-attach=yes --tool=memcheck --num-callers=50 ./bin/mysqld --no-defaults --basedir=. --datadir=./data --skip-gr --skip-na 

Then:
select master_pos_wait(0,0);
[18 Oct 2010 7:33] Valeriy Kravchuk
I can not repeat this on 32-bit Ubuntu 10.04.
[20 Oct 2010 19:41] Sveta Smirnova
Thank you for the report.

I can not repeat it as well. Please provide compile options you used and version of valgrind.
[6 Jun 2011 12:36] MySQL Verification Team
for future reference i filed oracle bug #12626874 which may or may not be related here.