Bug #51818 | Core Dump in mysql_stmt_close (Segmentation fault) | ||
---|---|---|---|
Submitted: | 8 Mar 2010 8:04 | Modified: | 30 Jan 2013 17:03 |
Reporter: | yog vashishth | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / C | Severity: | S1 (Critical) |
Version: | mysql-connector-c-6.0.2 | OS: | Linux (RHEL5) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[8 Mar 2010 8:04]
yog vashishth
[8 Mar 2010 9:18]
yog vashishth
Instead of start its restart We can have an application which does the following : in loop and then at regular interval we can re-start the Database server
[9 Mar 2010 9:13]
Sveta Smirnova
Thank you for the report. Please provide compete C test case demonstrating the problem. We need only example of client C code you are using, not script which restarts the server.
[20 Mar 2010 6:44]
yog vashishth
Hi Sveta As desired I am attaching a test case for the occurence of the scenario reported by me earlier (mysqltest1.cpp). I repeated the experiment again . This time restarting the mysql server every 9 second.(Attaching the script for same : restratMysqlServer.sh ). The coredump occured in the same fashion as reported earlier. The fullback trace of the dump is ============================================================================== No symbol table info available. #1 0x0000003795c31bf0 in abort () from /lib64/libc.so.6 No symbol table info available. #2 0x0000003795c6a38b in __libc_message () from /lib64/libc.so.6 No symbol table info available. #3 0x0000003795c714cc in _int_free () from /lib64/libc.so.6 No symbol table info available. #4 0x0000003795c74c5c in free () from /lib64/libc.so.6 No symbol table info available. #5 0x00002b5a2160a99d in mysql_stmt_close () from ./HSS-MYSQL-64/Implementation/db/lib/libmysql.so.16 No symbol table info available. #6 0x0000000000401c4d in querryDataBase () at mysqltest1.cpp:209 ex = (SQLException &) @0xb57c540: {<> = {<No data fields>}, error = "2003:Can't connect to MySQL server on '10.34.77.64' (111)", '\0' <repeats 111 times>, "TCP/IP (6)", '\0' <repeats 47 times>, "\004j!Z+\000\000`\fj!Z+\000\000ð\fj!Z+\000\000à\f", errNumber = 2003, errString = "Can't connect to MySQL server on '10.34.77.64' (111)\000+\000\000\000\fj!Z+\000\000\220\vj!Z+\000\000À\bj!Z+", '\0' <repeats 18 times>, "\201\033\000\000\000\000\000\000\000êô\2257\000\000\000\000êô\2257", '\0' <repeats 83 times>} l_stmt = (MYSQL_STMT *) 0xb57e230 l_outputBind = {{length = 0x7fff894f9dd0, is_null = 0x7fff894f9dcf "", buffer = 0x7fff894f9dc0, error = 0x7fff894f9dce "", row_ptr = 0x0, store_param_func = 0, fetch_result = 0, skip_result = 0, buffer_length = 0, offset = 0, length_value = 0, param_number = 0, pack_length = 0, buffer_type = MYSQL_TYPE_LONG, error_value = 0 '\0', is_unsigned = 0 '\0', long_data_used = 0 '\0', is_null_value = 0 '\0', extension = 0x0}} ---Type <return> to continue, or q <return> to quit--- l_length = 4 l_isNull = 0 '\0' l_error = 0 '\0' l_countRow = 1 counter = 152 #7 0x0000000000401fab in main () at mysqltest1.cpp:89 client_flag = 66560 reconnectFlag = 1 '\001' readTimeOut = 5 ================================================================================ The list command also shows that segmentation fault occured when mysql_stmt_close was called. Thanks Yog Vashishth
[20 Mar 2010 6:45]
yog vashishth
list =============================================================================== list 224 printf("\n [ %s::%d ]-->Exception mysql_stmt_close() failed\n",__FILE__,__LINE__); 225 printf("%d: %s \n",mysql_stmt_errno(l_stmt),mysql_stmt_error(l_stmt)); 226 } 227 } 228 printf("\n [ %s::%d ]-->Standard Exception ---------- %s\n",__FILE__,__LINE__,e.what()); 229 throw e; 230 } 231 232 233 } ===============================================================================
[20 Mar 2010 6:48]
yog vashishth
test case repeating the scenarion of the bug as reported
Attachment: mysqltest1.cpp (application/octet-stream, text), 6.13 KiB.
[20 Mar 2010 6:49]
yog vashishth
script to restart mysql server every 9 sec
Attachment: restratMysqlServer.sh (text/plain), 113 bytes.
[20 Mar 2010 6:51]
yog vashishth
compilation can be done using g++ -g mysqltest1.cpp -I $PATH_MYSQL_HEADER -L $PATH_MYSQL_CLENT_LIBRARY -lmysqlclient_r
[22 Mar 2010 9:58]
Sveta Smirnova
Thank you for the report. Verified as described. To repeat it faster I added sleep(2) before mysql_stmt_close
[22 Mar 2010 10:03]
Sveta Smirnova
Repeatable if link with regular C API bundled with server
[25 Mar 2010 6:19]
Adityakar Jha
Should we expect a fix for this bug?
[29 Apr 2010 11:19]
yog vashishth
Hi Sveta Are there any update regarding the fix of above reported bug Thanks & Regards Yog Vashishth
[29 Nov 2011 9:41]
Matthieu Lochegnies
Hi. I've taken a look at this bug, thinking it could be related with the 63363. In fact not. From my point of view, the problem is that you still use l_stmt after the mysql_stmt_close(). Even if the call fails, it frees the statement structure, so you may not access it further with mysql_stmt_errno and such, neither close it again calling mysql_stmt_close() in your exception handler. I think you should set l_stmt to 0 after you call mysq_stmt_close(), no matter if it returned a good or bad rc. And I'm also afraid you cannot get the statement error code after having called mysql_stmt_close(). Regards Matthieu
[30 Jan 2013 17:02]
Igor Solodovnikov
This is not a bug in connector code. The problem was that user was using MYSQL_STMT hanlde after closing it, which is not allowed.