Never Underestimate Your Own Stupidity
Posted by Davy Brion on January 7th, 2010
I was trying to deploy one of our applications on a customer’s environment. We have a database server on their network, and a web server. I installed the database, installed the web application and tried to run it. It didn’t. Our logfile showed this:
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 figured i had made a mistake with the configuration of SQL Server, so i checked some settings and tried it again. Still didn’t work. Did this a couple of times but i couldn’t get it to connect to the database and i kept getting the same error.
Eventually i wrote a stupid winforms app with a button that would connect to a database based on a connection string in its app.config file. Copied it to the webserver, copied the connection string from the web application to the config file of the stupid winforms app and tried it. Still got the same exception.
I figured there might be a problem with connecting to the database from the web server, so i copied the stupid winforms app to the database server and tried it there. It still didn’t work, even though i could connect without problems using SQL Server Management Studio.
After a while i finally noticed that i had mistyped the name of the database server in the connection string, and once i typed the correct name, everything worked
Total time lost: about 90 minutes.
Required change: adding 1 extra character to the connection string.
Then again, i would’ve noticed this sooner if the exception message was a bit more clear about the actual problem (not finding the server)

January 7th, 2010 at 5:30 pm
ROFL – it like’s a recurring nightmare that one!
January 7th, 2010 at 7:24 pm
It’s amazing what a difference a single character can make! I’ve had such moments too.
January 7th, 2010 at 8:31 pm
I’ve done that before myself. I agree that the error message is a bit vague, but I guess that’s about the best it can do. After all, the system doesn’t know what the connection string is supposed to look like, only that it tried to connect to it, never received a response, and subsequently timed out.
January 8th, 2010 at 6:55 am
Wherever one need to refer hard-coded stuff at different places, go for ‘Copy and Paste’ whenever possible. That would save considerably.
I have seen people struggling for days so 90 mins is OK. (want to make sure you don’t feel down.)
January 8th, 2010 at 8:40 am
@Kevin
well, it could list the actual connectionstring in the exception message when it can’t connect… most people will probably look at it then. though that still not an excuse for my brainfart obviously
@Dhananjay
agreed… that’s one of the few places where copy/pasting should be actively encouraged
January 8th, 2010 at 2:58 pm
Just make it a habit to create a udl file on the server where you deploy, set the connection, and copy-paste it to you config file.
January 8th, 2010 at 5:12 pm
Me and a co-worker spent a couple of hours debugging an app once, trying to figure out what was going wrong when it turned out to be a double dot in the nhibernate mapping file : ‘entity.hbm..xml’
Plenty more where that one came from.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning.”
Sometimes the software engineers are the idiots.
January 8th, 2010 at 8:19 pm
Been there, done that, but never had the courage to post it.
January 8th, 2010 at 8:34 pm
@Michel
the bigger the mistake, the more likely i am to write a post about it