Re: SQLFreeHandle hang
Martin Evans <[email protected]> Wed, 27 May 2009 12:06:26 +0100
| Newsgroups | gmane.comp.db.mysql.odbc |
|---|---|
| Organization | Easysoft Limited |
| Message-ID | <[email protected]> |
J Jayavasanthan wrote: > Hi, > My Application hangs on my second call to SQLFreeHandle's 'thread_protect( > SQL_HANDLE_ENV, environment );' line when I use the Threading option as > 0/1/2. When I use Threading=3 the default it works fine. > > For the above test I had ConnectionPooling enabled. > > When I disable ConnectionPooling, the SQLFreeHandle with Threading=0/1/2 the > hang doesn't happen. Is this a bug in configuration or am I missing > something. My code is tuned to use the same Environment across connections, > do let me know how I could avoid this, > > Regards, > Jay > Some people on this list may be surprised/confused where you are now as you did not close your previous thread by saying that what I previously suggested to you worked - namely looking at add Threading option to your ODBC driver configuration. It is generally good practise if you start a thread and find a resolution to post back explaining how you resolved the problem so others can see the solution. Threading = 0 all thread protection in the ODBC driver manager for the ODBC driver is turned off - unxiODBC will only protect its own internal structures. Threading = 1 protects down to the statement level Threading = 2 protects down to the connection level Threading = 3 protects down to the environment level IF you ODBC driver is thread-safe you can set Threading to 0. On the other hand if you are unsure if your driver is thread-safe but threads only share the environment you can use Threading = 3. If you are unsure your driver is thread-safe and threads share connections you need to use 2 etc. A hang almost definitely suggests something is protecting some structure and another thread is attempting to get the same resource and vice versa. You say you share environments across threads so you should either use 0 (meaning you are saying your ODBC driver is thread-safe and unixODBC should only protect itself) or 3 meaning unixODBC will stop multiple threads using the same environment at the same time. If you set threading to 1 or 2 and multiple threads attempt to use the same connection or statement you will get problems. If you are definitely saying setting Threading = 0 and you still get a problem in thread_protect when using connection pooling I suggest you report this on one of the unixodbc mailing lists which you can find from www.unixodbc.org. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com -- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/[email protected]