PoolCreateRequest exception

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here is the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnections() + 0xae bytes

system.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(System.Object state = null) + 0x5b bytes


Note that the get_Item call happens on a different thread than the other two
calls on the stack. The other two occur on the thread launched by BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be able to
remedy the problem by changing the pooling config, but I'd like to know what
is happening here.

Thanks for any help,
Mike
 
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here is the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytessystem.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes
 
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.


Angel Saenz-Badillos said:
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here is the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytessystem.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes
Note that the get_Item call happens on a different thread than the other two
calls on the stack. The other two occur on the thread launched by BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be able to
remedy the problem by changing the pooling config, but I'd like to know what
is happening here.

Thanks for any help,
Mike
 
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.



Angel Saenz-Badillos said:
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here is the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytessystem.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes
Note that the get_Item call happens on a different thread than the other two
calls on the stack. The other two occur on the thread launched by BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be able to
remedy the problem by changing the pooling config, but I'd like to know what
is happening here.

Thanks for any help,
Mike
 
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.


Angel Saenz-Badillos said:
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here is the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytessystem.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes
Note that the get_Item call happens on a different thread than the other two
calls on the stack. The other two occur on the thread launched by BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be able to
remedy the problem by changing the pooling config, but I'd like to know what
is happening here.

Thanks for any help,
Mike
 
Some comments on the connection string:
Min Pool Size=1 //I would not use Min Pool Size unless there was an
overriding reason to.
Connection Lifetime=5; //This is very bad, take a look at the following blog
for more info :http://weblogs.asp.net/angelsb/archive/2004/09/20/231963.aspx
Connection Reset=False; //You should not use this unless you are connecting
to Sql 6.5. Even then you need to guarantee that your connection is
stateless.

Is it possible to post some code?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.


Angel Saenz-Badillos said:
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception. Here
is
the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index = 2) +
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytes system.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes
Note that the get_Item call happens on a different thread than the
other
two
calls on the stack. The other two occur on the thread launched by BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be able to
remedy the problem by changing the pooling config, but I'd like to
know
what
is happening here.

Thanks for any help,
Mike
 
Sorry, for the Connection Reset I meant to say don't use it unless you are
connecting to Sql Server 7. The reason for this keyword is that in Sql
Server 7 we needed to do additional work to ensure that a connection gets
resetted. In Sql Server 2000 and 2005 the cost of the reset is practically
negligible and easily offsets the risks of not resetting the connection each
time it is retrieved from the pool.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Angel Saenz-Badillos said:
Some comments on the connection string:
Min Pool Size=1 //I would not use Min Pool Size unless there was an
overriding reason to.
Connection Lifetime=5; //This is very bad, take a look at the following blog
for more info :http://weblogs.asp.net/angelsb/archive/2004/09/20/231963.aspx
Connection Reset=False; //You should not use this unless you are connecting
to Sql 6.5. Even then you need to guarantee that your connection is
stateless.

Is it possible to post some code?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.


Angel Saenz-Badillos said:
Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception.
Here
2)
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnectionsystem.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst able
 
Thanks again, Angel.

Sorry about the multiple posts. The site was telling me that it was
encoutering errors at post time, so I resent the message twice.

I made a mistake in my first post when I stated "Note that the get_Item call
happens on a different thread than the other two calls on the stack. The
other two occur on the thread launched by BeginInvoke." I'm actually seeing
two or more threads navigating the same stack frames simultaneously, i.e.,
all threads are checking for dead connections at the same time. When the
exception is encountered, the thread that throws it has made it through all
three frames, while the others have only made it to the second. What could I
be doing that is causing the ConnectionPool object to fail?

I should have mentioned that I am aware of the shortcomings in the
connection string. At the moment, that's the one in use and I wanted to be
specific about the environment of execution. I've tried eliminating
Connection Reset and setting Enlist=False, but this did not prevent the
problem.

Since my last post, I have changed the code to no longer use the same
DataSet on different threads. I'm creating a new/clean instance of the object
that contains the function that is invoked asynchronously. (It is actually a
second instance of the object that makes the call.) The problem remains.

Thanks!


Angel Saenz-Badillos said:
Sorry, for the Connection Reset I meant to say don't use it unless you are
connecting to Sql Server 7. The reason for this keyword is that in Sql
Server 7 we needed to do additional work to ensure that a connection gets
resetted. In Sql Server 2000 and 2005 the cost of the reset is practically
negligible and easily offsets the risks of not resetting the connection each
time it is retrieved from the pool.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Angel Saenz-Badillos said:
Some comments on the connection string:
Min Pool Size=1 //I would not use Min Pool Size unless there was an
overriding reason to.
Connection Lifetime=5; //This is very bad, take a look at the following blog
for more info :http://weblogs.asp.net/angelsb/archive/2004/09/20/231963.aspx
Connection Reset=False; //You should not use this unless you are connecting
to Sql 6.5. Even then you need to guarantee that your connection is
stateless.

Is it possible to post some code?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Mike Hansen said:
Thanks, Angel.

There are two DataSets, but no other ADO.NET objects, that are used by both
threads. The first thread that spins off the delegate is done using the
DataSets by the time the async call is made. There is an outstanding
transaction that has not been committed at this point.

If I set Pooling to FALSE in the connection string, I do not get the error.
My understanding is that ADO.NET will not use the same pooled connection for
different threads, so I'm not sure why this fixes the problem.

Thanks again for your response.


:

Have you guaranteed that you are not using ado.net objects in multiple
threads at the same time?

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




Good day, all,

I have a SingleCall remoting service that spins off an asynchronous call
using BeginInvoke. The call/thread accesses the database, queues a message
and returns. It works fine. After 3 minutes, I get an exception.
Here
is
the
stack trace:

mscorlib.dll!System.Collections.ArrayList::get_Item(__int32 index =
2)
+
0x51 bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::CheckForDeadConnection
s() + 0xae bytes
system.data.dll!System.Data.SqlClient.ConnectionPool::PoolCreateRequest(Syst
em.Object state = null) + 0x5b bytes


Note that the get_Item call happens on a different thread than the other
two
calls on the stack. The other two occur on the thread launched by
BeginInvoke.


Here is my connection string:
Data Source=192.168.20.51;Initial Catalog=TEST;Uid=TestUser;Persist
Security
Info=true;pwd=test;Pooling=True;Min Pool Size=1;Max Pool
Size=50;Connection
Lifetime=5;Connection Reset=False;Enlist=True


Has anybody encountered this problem? I'm thinking that I may be
able
to
remedy the problem by changing the pooling config, but I'd like to know
what
is happening here.

Thanks for any help,
Mike
 
Back
Top