Hope someone can help us as we get to the investigations.
We have a simple asynchronous socket server written in C # that accepts connections from an ASP.NET web application, sends a message, does some processing (usually from the database, but with other systems), and then sends the response back to customer. The client is responsible for closing the connection.
We are having problems when the system is under heavy load for a long period of time (usually days), CLOSE_WAIT sockets grow on the server (netstat -a) to such an extent that the process will not accept any further connections. At this point, we must bounce the process and start it again.
We tried to run some load tests on our ASP.NET application to try to replicate the problem (because it was impossible to get some problem out of the code). We think that we managed to do this, and as a result we got WireShark packet tracing of the problem, which manifests itself as a SocketException in the socket server logs:
System.Net.Sockets.SocketException: an existing connection was forcibly closed by the remote host in System.Net.Sockets.Socket.BeginSend (Byte buffer [], Int32 offset, Int32 size, SocketFlags socket flag, AsyncCallback callback, object state)
I tried to reproduce the problem from the packet trace as a single-threaded process directly connected to the socket server (using the same code as the ASP.NET application), and could not.
- - , , , ?