Have you ever tried to run a very network-intensive P2P application on Windows XP SP2 or higher? If so, you may have encountered very strange behaviour with the Windows TCP/IP network stack. Specifically, you won't be able to open any new TCP/IP connections, so web-browsing, email checking, SSH, etc will all be basically unusable. At the same time, P2P transfers might be running fine for all you can tell. I spent some time trouble-shooting all aspects of my set up including testing the router, my Internet connection, and even re-installing Windows a couple of times - all to no avail. Finally I figured out the source of the problem, and how to fix it! It turns out that this behaviour is due to a feature introduced in Windows XP Service Pack 2 which limits the number of TCP/IP sockets you can have in the 'half-open' state to 10. A connection in the TCP half-open state means that one side of the socket has disappeared and stopped responding, without properly notifying the other side. After 10 such connections, the Windows kernel queues up all new socket connection attempts and you will experience this network "freeze" behaviour. Apparently the reason for Microsoft having this low default is to slow the spread of virii and limit infected hosts from participating in DoS attacks etc. Unfortunately, P2P applications in particular are very negatively affected by this low default, because they are constantly opening new connections to peers, they very quickly fill up the default limit of 10 half-open connections. half-open_limit_fix_en The good news is that once you realise this is the problem you are encountering, its trivial to fix. There is a very simple patch which raises this default to any value, with a recommended setting of 100. I have used this patch a couple of times, setting the default to 100, and it has completely solved the issue for me. Yet another annoying, niggling thing to install on a fresh Windows system! Oh well.

Niall O'Higgins is an author and software developer. He wrote the O'Reilly book MongoDB and Python. He also develops Strider Open Source Continuous Deployment and offers full-stack consulting services at FrozenRidge.co.

blog comments powered by Disqus