Bug #3353 Prepared statement execution causes crash if binary log is enabled
Submitted: 31 Mar 2004 18:47 Modified: 7 Apr 2004 13:49
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1-bk OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[31 Mar 2004 18:47] Sergey Petrunya
Description:
Server with enabled binary log will fail assertion when executing any prepared statement with parameters.
The same statements execute without problems if binary log is disabled. 

How to repeat:
Start server with binary logging turned on.
Prepare any statement with parameters, e.g. "SELECT ?".
Try to execute it.
Server will fail assertion.
[31 Mar 2004 18:48] Sergey Petrunya
Here is the stack trace.

mysqld: item.cc:764: String* Item_param::query_val_str(String*): Assertion `fixed == 1' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 147466 (LWP 12023)]
0x40133b71 in kill () from /lib/i686/libc.so.6
(gdb) bt
#0  0x40133b71 in kill () from /lib/i686/libc.so.6
#1  0x40047cf1 in pthread_kill () from /lib/i686/libpthread.so.0
#2  0x4004800b in raise () from /lib/i686/libpthread.so.0
#3  0x40133904 in raise () from /lib/i686/libc.so.6
#4  0x40134e8c in abort () from /lib/i686/libc.so.6
#5  0x4012ce84 in __assert_fail () from /lib/i686/libc.so.6
#6  0x080df2de in Item_param::query_val_str(String*) (this=0x85eacf0, str=0x416f3adc) at item.cc:764
#7  0x081b3a35 in insert_params_withlog (stmt=0x85eacf0, null_array=0x85dffe2 "", read_pos=0x85dffea "",
    data_end=0x85dffea "") at sql_prepare.cc:477
#8  0x081b54b0 in mysql_stmt_execute(THD*, char*, unsigned) (thd=0x85d7a38, packet=0x85dffe6 "\003", packet_length=18)
    at sql_prepare.cc:1150
#9  0x0816e45f in dispatch_command(enum_server_command, THD*, char*, unsigned) (command=COM_BINLOG_DUMP, thd=0x85d7a38,
    packet=0x85dffd9 "\001", packet_length=18) at sql_parse.cc:1420
#10 0x0816de7b in do_command(THD*) (thd=0x85d7a38) at sql_parse.cc:1265
#11 0x0816d38a in handle_one_connection (arg=0x0) at sql_parse.cc:1015
#12 0x40044f60 in pthread_start_thread () from /lib/i686/libpthread.so.0
#13 0x400450fe in pthread_start_thread_event () from /lib/i686/libpthread.so.0
#14 0x401e6327 in clone () from /lib/i686/libc.so.6
(gdb) frame 6
#6  0x080df2de in Item_param::query_val_str(String*) (this=0x85eacf0, str=0x416f3adc) at item.cc:764
764       DBUG_ASSERT(fixed == 1);
(gdb) print *this
$1 = {<Item> = {_vptr.Item = 0x835a7e8, str_value = {Ptr = 0x0, str_length = 0, Alloced_length = 0, alloced = false,
      str_charset = 0x84c8da0}, name = 0x83babe0 "?", next = 0x0, max_length = 0, marker = 0 '\0', decimals = 0 '\0',
    maybe_null = 0 '\0', null_value = 0 '\0', unsigned_flag = 0 '\0', with_sum_func = 0 '\0', fixed = 0 '\0', collation = {
      collation = 0x84c9780, derivation = DERIVATION_COERCIBLE}}, value_is_set = true, int_value = 3,
  real_value = -2.4983353906949635e-127, ltime = {year = 2779096485, month = 2779096485, day = 2779096485,
    hour = 2779096485, minute = 2779096485, second = 2779096485, second_part = 2779096485, neg = 165,
    time_type = -1515870811}, item_result_type = INT_RESULT, item_type = INT_ITEM, buffer_type = -1515870811,
  item_is_time = false, long_data_supplied = false, pos_in_query = 7,
  set_param_func = 0x81b3546 <set_param_int32(Item_param*, unsigned char**, unsigned long)>}
[3 Apr 2004 6:39] Oleksandr Byelkin
ChangeSet 
  1.1768 04/04/03 17:23:41 bell@sanja.is.com.ua +3 -0 
  for Item_param we have to have value set instead of fave item fixed 
(BUG#3353) 
  fixed outer joins 
  test of different joins included
[7 Apr 2004 13:49] Oleksandr Byelkin
Thank you for bugreport. changes pushed in bk source repository.