I'm running IIS on Server 2008 R2. Recently, I've seen a lot of errors like this:
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.
When I go into the IIS manager and look at the worker processes, I see that this application pool has a bunch of requests that have been running for over an hour each. I'm guessing that they're holding on to db connections, which is why nobody else can get one.
So, two questions:
- Why didn't IIS timeout and kill off these requests? (They normally complete in 1 - 2 seconds.)
- How do I make sure this doesn't happen?
Thanks!
IIS isn't making those database connections, your app is.
You need to troubleshoot the issue according to the application framework you're using (from the look of it, I'd guess .Net with connection pooling) - I'd guess you're leaking connections, possibly due to not cleaning up properly (calling Close or Dispose) or having some weird exception handling code that forgets to clean up.
IIS can't magically do that because your app hasn't indicated that it's finished performing work - IIS doesn't know if the database is slow or the exception handler isn't cleaning up properly, it just knows it started a request at point X, and it hasn't returned so it might still be busy.
Some apps use incredibly long-running connections and don't respond positively to having the connection terminated forcibly.