Timeout error

D

DougS

We have an ASP.Net (framework 1.1) app that does a lot of database reads and
updates. The app has a dozen pages and we're about 90% done and all of a
sudden I'm getting this error:
Timeout expired. The timeout period elapsed prior to obtaining a connection
from the pool. This may have occurred because all pooled connections were in
use and max pool size was reached.

It's not happening in the same place each time. I added the max pool size
and pooling properties to my connection string and I'm still getting the
error.

"server=*****;database=*****;uid=*****;pwd=*****;pooling=true;Max pool
size=100;"

We use sqlcommand objects with datareaders to populate datagrids and
datalists. Whenever we create a connection we explicitly close it.

Thanks in advance,

DougS
 
P

PL

This is a bug, even though MS doesnt want to admit that it is, if you search on
google for the error you'll see you are not alone.

Unfortunately people still claim this is because you don't properly close connections,
although this can be true there is something else causing this as well.

I actually resorted to a creating a script that pulls the SP_WHO stored procedure
and counts the connections in the db, if it's over 200 I restart the IIS service.

This is a last resort and I did this so the stupid thing wouldnt shutdown the site,
because even if the max pool is reached you woudl think ti evetually comes back
up on it's own but it doesnt (like I said it's a bug no matter what MS says ;).

Although, the first thing you shoudl try it going through all your scripts making sure
you close the connectionts and close all readers, and make sure you do so inside
finally clauses so connections are not left open after exceptions !

Do a search on google and read other posts and blogs as well.

PL.
 
B

BradC

Hello PL,

There IS a bug that has to do with rapidly opening or closing connections
with sql debugging enabled in Visual Studio 2003, so that issue is worth
investigating:

http://support.microsoft.com/default.aspx?scid=kb;en-us;830118

Here is what I considert to be the "authoritative" article the "Timeout expired"
error and connection pooling, written by someone on the ADO development team
at Microsoft:

Connection Pooling and the "Timeout expired" exception FAQ
http://blogs.msdn.com/angelsb/archive/2004/08/25/220333.aspx

I don't have all the details, but it is apparently very easy to see if you
are leaking connections in ADO.Net 2.0 by using the new NumberOfReclaimedConnections
performance counter.

Hope this helps,
BradC
 
D

DougS

I turned of SQL debugging and put all my connection and reader closings in
FINALLY clauses. That definitely helped.

Thanks,
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top