Sunday, 8 September 2013

What can cause a timeout getting SQL connection from pool?

What can cause a timeout getting SQL connection from pool?

I have a web app deployed under IIS. It's been getting timeout errors, and
I believe I've tracked the problem down to code that doesn't properly
dispose of SQL connections.
This will require quite a lot of surgery to fix, so at least until I can
finish implementing and testing the new code, using using blocks
correctly, I decided to bump up the connection pool size to something
astronomical. But that doesn't seem to have helped. My connection string
is:
Data Source=MyServer;Initial Catalog=MyDb;User
ID=MyUser;Password=MyPwd;Max Pool Size=10000
And my log file shows:
System.InvalidOperationException: 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.
I have been keeping Performance Monitor open over this period, and the
number of user connections maxed out at around 150. So I don't think it
can be that we're running out of connections.
What else could be causing this error?

No comments:

Post a Comment