views:

1724

answers:

5

I've started seeing this message intermittently for a few of the unit tests in my application (there are over 1100 unit & system tests). I'm using the test runner in ReSharper 4.1.

One other thing: my development machine is a VMWare virtual machine.

+5  A: 

I ran into this many moons ago. Bottom line is you are running out of available ports.

First make sure your calling application has collection pooling on.

If that does then check the number of available ports for the SQL Server.

What is happening is that if pooling is off then every call takes a port and it takes by default 4 minutes to have the port expire, and you are running out of ports.

If pooling is on then you need to profile all the ports of SQL Server and make sure you have enough and expand them if necessary.

When I came across this error, connection pooling was off and it caused this issue whenever a decent load was put on the website. We did not see it in development because the load was 2 or 3 people at max, but once the number grew over 10 we kept seeing this error. We turned pooling on, and it fixed it.

David Basarab
+2  A: 

I ran into this many moons ago as well. However, not to discount @Longhorn213s explanation, but we had the exact opposite behavior. We received the error in development and testing, but not production where obviously the load was much greater. We ended up tolerating the issue in development as it was sporadic and didn't materially slow down progress. I think there could be several reasons for this error, but was never able to pin point the cause myself.

JasonS
A: 

I've seen that a lot when the network was funky, or the NIC was on the way out. Check out your network stack.

Danimal
A: 

We saw this in our environment, and traced part of it down to the "NOLOCK" hint in our queries. We removed the NOLOCK hint and set our servers to use Snapshot Isolation mode, and the frequency of these errors was reduced quite a bit.

Jay Mooney
A: 

We've also run across this error and figured out that we were killing a SQL server connection from the database server. The client application is under the impression that the connection is still active and tries make use of that connection, but fails because it was terminated.

Trumpi