I have an existing (multithreaded) code which is fetching data using ODBC API calls. The problem is that it hangs occasionally.
I have taken a hang dump, which tells me that the application is hung on
SQLFreeStmt(hstmt, SQL_DROP), which in turn is hung on ntdll!RtlpWaitOnCriticalSection. From my application logs, I could deduce that the hang occurs sometime after I call
SQLCancel(hstmt) from another thread which was actually fetching data. I had to call
SQLCancel due to some error in my application. So far, whenever the application hangs, it contains such a cancelled statement some time before
I am not sure whether my code is aborting the executing statement in correct way and whether cancelling the running query attached to the hstmt will invalidate the handle or leave any lock on the valid handle? Also, what will happen if we pass an invalid
handle to SQLFreeStmt.
I would highly appreciate your help here.
View Complete Post