Bug #5244 Stored procedure crash if function parameter change
Submitted: 26 Aug 2004 23:54 Modified: 28 Sep 2004 13:45
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Bugs System CPU Architecture:Any

[26 Aug 2004 23:54] Peter Gulutzan
Description:
I change an input parameter within a function, then return the parameter. I believe the 
crash occurs only if I pass a column value, and there at least two rows. 
 

How to repeat:
mysql> create table t305 (s1 int)// 
Query OK, 0 rows affected (0.30 sec) 
 
mysql> insert into t305 values (5),(5)// 
Query OK, 2 rows affected (0.00 sec) 
Records: 2  Duplicates: 0  Warnings: 0 
 
mysql> create function f305 (param1 tinyint) returns int begin set param1 = 5; return 
param1; end;// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select f305(s1) from t305// 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[29 Aug 2004 10:54] Alexander Keremidarski
(gdb) bt
#0  0xffffe410 in ?? ()
#1  0x410b372c in ?? ()
#2  0x00000006 in ?? ()
#3  0x4e3b3872 in abort () from /lib/tls/libc.so.6
#4  0x4e3ab718 in __assert_fail () from /lib/tls/libc.so.6
#5  0x081cd87c in close_thread_table(THD*, st_table**) (thd=0x0, table_ptr=0x86beb24) at sql_base.cc:438
#6  0x081cd71d in close_thread_tables(THD*, bool, bool) (thd=0x86bd8e0, lock_in_use=false, skip_derived=false) at sql_base.cc:411
#7  0x082aee1f in sp_instr_set::execute(THD*, unsigned*) (this=0x86f8d80, thd=0x86bd8e0, nextp=0x0) at sp_head.cc:1207
#8  0x082aca51 in sp_head::execute(THD*) (this=0x86f8af0, thd=0x86bd8e0) at sp_head.cc:464
#9  0x082ace8d in sp_head::execute_function(THD*, Item**, unsigned, Item**) (this=0x86f8af0, thd=0x86bd8e0, argp=0x86ec1fc, argcount=1, resp=0x0) at sp_head.cc:571
#10 0x0812cb4a in Item_func_sp::execute(Item**) (this=0x86ec188, itp=0x0) at item_func.cc:3299
#11 0x081356ef in Item_func_sp::val_int() (this=0x86ec188) at item_func.h:1131
#12 0x081142a2 in Item::send(Protocol*, String*) (this=0x86ec188, protocol=0x86be1ec, buffer=0x410b3c60) at item.cc:1883
#13 0x08181f92 in select_send::send_data(List<Item>&) (this=0x86ec448, items=@0x86be1ec) at sql_class.cc:761
#14 0x081eb07d in end_send (join=0x86ec458, join_tab=0x86ed604, end_of_records=false) at sql_select.cc:8399
#15 0x081e9b4a in sub_select (join=0x86ec458, join_tab=0x86ed4b0, end_of_records=6) at sql_select.cc:7775
#16 0x081e95b8 in do_select (join=0x86ec458, fields=0x86ed4b0, table=0x0, procedure=0x0) at sql_select.cc:7473
#17 0x081dbec7 in JOIN::exec() (this=0x86ec458) at sql_select.cc:1550
#18 0x081dcbb4 in mysql_select(THD*, Item***, st_table_list*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned long, select_result*, st_select_lex_unit*, st_select_lex*) (thd=0x86bd8e0, rref_pointer_array=0x86bdbac, tables=0x86ec260, wild_num=0, fields=@0x0, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=42224128, result=0x86ec448, unit=0x86bd920, select_lex=0x86bdaac) at sql_select.cc:1972
#19 0x081d8356 in handle_select(THD*, st_lex*, select_result*) (thd=0x86bd8e0, lex=0x86bd914, result=0x86ec448) at sql_select.cc:209
#20 0x081a7c6a in mysql_execute_command(THD*) (thd=0x86bd8e0) at sql_parse.cc:2039
#21 0x081ae33a in mysql_parse(THD*, char*, unsigned) (thd=0x86bd8e0, inBuf=0x86ec060 "select f305(s1) from t305", length=141285652) at sql_parse.cc:4432
#22 0x081a66f7 in dispatch_command(enum_server_command, THD*, char*, unsigned) (command=COM_QUERY, thd=0x86bd8e0, packet=0x86e4001 "", packet_length=26) at sql_parse.cc:1486
#23 0x081a5fec in do_command(THD*) (thd=0x86bd8e0) at sql_parse.cc:1296
#24 0x081a545d in handle_one_connection (arg=0x0) at sql_parse.cc:1032
#25 0x4e5c798c in start_thread () from /lib/tls/libpthread.so.0
#26 0x4e44616a in clone () from /lib/tls/libc.so.6
[28 Sep 2004 13:45] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

This is no longer repeatable.