Windows Sockets fun

Simple stress application brings down Windows Sockets subsystem within tens of seconds on Microsoft Windows XP Professional Service Pack 2… It appears to be a key point that SO_RCVBUF and SO_SNDBUF sockets options are increased from default value.

The expected behavior, and it is the case with default socket buffer sizes, is running out of available anonymous sockets (ports 1024-5000 are engaged by active sockets or those on wait list to be freed, see “Windows NT Clients Run Out of Ports” for details). Expected failure code is 10048 (WSAEADDRINUSE) “Address already in use” on client.

Instead, at some critical moment client side sockets start failing with 10054 (WSAECONNRESET) “Connection reset by peer” error and server side sockets massively fail with 10093 (WSANOTINITIALISED) “Successful WSAStartup not yet performed” code including, as it seems, a number of sockets already closed on client side and expected to get closed on server. After server connection sockets report failure, the listening socket reports ERROR_OUT_OF_MEMORY error.

Download Visual Studio .NET 2003 source code and compiled binaries.

2 Replies to “Windows Sockets fun”

Leave a Reply