Enterprise Library Data Access – Max Pool Size Reached

A co-worker and I were looking into a recurring problem with one of our oft-used data access web services. It was a problem that had come up at several different customer sites, and the symptoms were always the same. Everything would be working for for x hours, and then we start to get exceptions. Some time later, it starts working again. This process repeats.

Here’s the exception that we’d start to see after some time:

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.

After a big of googling and some experimentation, the cause was found to be an IDataReader that wasn’t being closed properly. After we wrapped it in a using, everything was working just fine. Always make sure to dispose of your IDisposables!

Advertisement

Author: Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: