[unixODBC-support] Crashing using unixODBC + MySQL drivers and custom executable

Martin Evans martin.evans at easysoft.com
Tue Aug 14 09:47:38 BST 2007


Rory Hart wrote:
> Hi,
> 
> Just like to state first off, thanks for a great piece of software, 
> using it I was quickly and easily able to port a windows application to 
> Linux  :D
> 
> It works great and hasn't had any problems until the MySQL server it is 
> was connected to went down. The application makes a request to the 
> server, which of course fails and when the application attempts to clean 
> up the failed statement handle using SQLFreeHandle( SQL_HANDLE_STMT,  
> statement_handle ) the application crashes.
> 
> I am limited in what code I can post as it is proprietary but I will try 
> to be as complete as possible.
> 
> First of all we're running:
> 
> Fedora Core 6 (kernel 2.6.18-1.2798)
> MySQL 5.0.27
> MySQL Connector ODBC 3.51.12-2.2
> unixODBC 2.2.11-7.1
> 
> These were all installed using rpms.
> 
> The call stack at time of crashing:
> 
> #0  0x00bdc402 in __kernel_vsyscall ()
> #1  0x00ac3d40 in raise () from /lib/libc.so.6
> #2  0x00ac5591 in abort () from /lib/libc.so.6
> #3  0x00af918b in __libc_message () from /lib/libc.so.6
> #4  0x00b00efd in _int_free () from /lib/libc.so.6
> #5  0x00b04550 in free () from /lib/libc.so.6
> #6  0x00130411 in my_no_flags_free () from 
> /usr/lib/mysql/libmysqlclient_r.so.15
> #7  0x00f45378 in my_SQLFreeStmt () from /usr/lib/libmyodbc3_r.so
> #8  0x00f456e5 in SQLFreeHandle () from /usr/lib/libmyodbc3_r.so
> #9  0x009120e6 in SQLFreeEnv () from /usr/lib/libodbc.so.1
> #10 0x009127d5 in SQLFreeHandle () from /usr/lib/libodbc.so.1
> #11 0x0804df45 in odbcRequest
> 
> There are a few more below this in the stack but they don't hold any 
> relevant code.
> 
> This is sanitized version of the code with the unneeded program logic 
> cut out.
> 
> rc = SQLAllocStmt( hdbc, &statement_handle );
> 
> if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
> {
>    /* Log Error clean up and return if needed */
> }
> 
> rc = SQLBindParameter( statement_handle, 1, SQL_PARAM_INPUT, SQL_C_CHAR, 
> SQL_LONGVARCHAR, strlen(searchvar), 0, searchvar, 0, SQL_NTS );
> 
> if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
> {
>    /* Log error, clean up and return if needed */
> }
> 
> rc = SQLExecDirect( statement_handle, query, SQL_NTS );
> 
> if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
> {
>    SQLFreeHandle( SQL_HANDLE_STMT,  statement_handle );
>    /* Log error, clean up and return if needed */
> }
> 
> It is in the last error handling where the handle is cleaned up that it 
> crashes. I hope someone is able to make sense of this and maybe provide 
> an answer.
> 
> Thanks in advance
> 
> Rory
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> 
> 
The last call before runtime c library was:

my_no_flags_free () from /usr/lib/mysql/libmysqlclient_r.so.15

so it fell over in mysql driver. I think you'd be better off on a mysql 
odbc driver list as although the other software in the chain cannot be 
ruled out I'd be surprised if it was anything other than mysql odbc 
driver as unixodbc does not know your mysql server has gone away.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com



More information about the unixODBC-support mailing list