| Bug #1663 | Server crash if connection is closed without mysql_stmt_close call | ||
|---|---|---|---|
| Submitted: | 25 Oct 2003 18:49 | Modified: | 20 Jan 2004 11:25 |
| Reporter: | Dmitri Lenev | ||
| Status: | Closed | ||
| Category: | Server | Severity: | S2 (Serious) |
| Version: | 4.1 | OS: | |
| Assigned to: | Alexey Botchkov | Target Version: | |
[25 Oct 2003 18:49]
Dmitri Lenev
[26 Oct 2003 1:44]
Dmitri Lenev
Actually the crash can be reproduced even with mysql_stmt_close(); You just need to execute some query via the same connection after mysql_execute() but before mysql_stmt_close(): ... stmt= mysql_prepare(mysql,"SELECT i FROM test_bg1663 WHERE i IN (?,?,?)",44); bind[0].buffer= (char *)int_data; bind[0].buffer_type= FIELD_TYPE_LONG; bind[0].is_null= 0; bind[2]= bind[1]= bind[0]; bind[1].buffer= (char *)(int_data + 1); bind[2].buffer= (char *)(int_data + 2); rc= mysql_bind_param(stmt, bind); rc= mysql_execute(stmt); rc = mysql_query(mysql, "SELECT * FROM test_bg1663"); result = mysql_store_result(mysql); /* ... fetch and free result here */ /* Server should crash here :( */ mysql_stmt_close(stmt); I suspect that the reason of this bug is following: When we are executing prep stmt we allocate some memory in current mem_root (in this example in Item_func_in::fix_length_and_dec()), and put a pointer to created object in Item_func_in::array which is allocated in prep stmt memroot. After that we execute next query, so memory in current mem_root is destroyed... But Item_func_in::array still references it , so then we do delete array; in ~Item_func_in() we receive SIGSEGV. Probably we will have the same problem with any Item which destroys objects allocated during execution (in fix_fields() or in val()) in its destructor (do we have any?)...
[14 Dec 2003 17:02]
Dmitri Lenev
See also another manifestation of this problem in bug report #2099
[14 Dec 2003 21:46]
Miguel Solorzano
Dmitri I am changing the Priority from Medium to High due to similar issues at customer side.
[20 Jan 2004 11:25]
Alexey Botchkov
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:
Fixed with the big cleanup()-related changeset
