SQLFreeHandle hang

SQLFreeHandle hang

am 27.05.2009 12:34:30 von J Jayavasanthan

--0016363b85b07896dc046ae26377
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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

--0016363b85b07896dc046ae26377--

Re: SQLFreeHandle hang

am 27.05.2009 12:53:10 von Nick Gorham

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
>
>
This may be a unixODBC problem, try the 2.2.15pre thats on
ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.2.15pre.tar.g z and let me
know if the problem persists.

--
Nick Gorham
Easysoft Ltd + unixODBC

--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@m.gmane.org

Re: SQLFreeHandle hang

am 27.05.2009 13:06:26 von Martin Evans

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/myodbc?unsub=gcdmo-myodbc@m.gmane.org

Re: SQLFreeHandle hang

am 27.05.2009 13:26:50 von J Jayavasanthan

--0016e64713b49e163b046ae31e37
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi Martin,
Thanks for your inputs, I was trying out Threading=0 initially, but I wanted
to make sure I am not breaking anything, so I wanted to make sure every code
is working fine.

In the above test, I have a code which connects the database, executes a few
queries and then closes the database connection, and then creates another
new connection and executes a few queries and then closes the connection ->
All in single thread. This was a standard app code and I have checked that
all structures are freed properly.

If connection pooling is enabled, when I close the second connection I am
getting the hang. Hence, I tried out various options like Threading=1/2 as
well. Then we found out that when connection pooling is disabled, the
problem is not faced. Hence I posted the above error.

I am willing to go with Threading=0 but I would have to have the connection
pooling enabled as the way my application works with the database, the
pooled connections will be needed for better performance of the app.

I am currently trying out Nick's suggestion, I will let you know if the
problem is resolved and what I have done to resolve the issues.

BTW, Thanks for all your help in resolving my errors,

Best Regards,
Jay






On Wed, May 27, 2009 at 4:36 PM, Martin Evans wrote:

> 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/myodbc?unsub=jayavasanthan@gmail.com
>
>


--
first me then home
first home then country
first country then world
fools always read inverse

--0016e64713b49e163b046ae31e37--

Re: SQLFreeHandle hang

am 29.05.2009 14:38:41 von J Jayavasanthan

--000e0cd32a603d4c6a046b0c5bc7
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi All,
As per Nick's suggestion, we downloaded the latest pre-release build from
unixodbc and were able to resolve our issues,

Now we are able to use Threading=0 as well as Connection Pooling without any
errors,

Thanks for Nick and Martin for all their help,

Best Regards,
Jay

On Wed, May 27, 2009 at 4:56 PM, J Jayavasanthan wrote:

> Hi Martin,
> Thanks for your inputs, I was trying out Threading=0 initially, but I
> wanted to make sure I am not breaking anything, so I wanted to make sure
> every code is working fine.
>
> In the above test, I have a code which connects the database, executes a
> few queries and then closes the database connection, and then creates
> another new connection and executes a few queries and then closes the
> connection -> All in single thread. This was a standard app code and I have
> checked that all structures are freed properly.
>
> If connection pooling is enabled, when I close the second connection I am
> getting the hang. Hence, I tried out various options like Threading=1/2 as
> well. Then we found out that when connection pooling is disabled, the
> problem is not faced. Hence I posted the above error.
>
> I am willing to go with Threading=0 but I would have to have the connection
> pooling enabled as the way my application works with the database, the
> pooled connections will be needed for better performance of the app.
>
> I am currently trying out Nick's suggestion, I will let you know if the
> problem is resolved and what I have done to resolve the issues.
>
> BTW, Thanks for all your help in resolving my errors,
>
> Best Regards,
> Jay
>
>
> On Wed, May 27, 2009 at 4:36 PM, Martin Evans wrote:
>
>> 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/myodbc?unsub=jayavasanthan@gmail.com
>>
>

--000e0cd32a603d4c6a046b0c5bc7--