ColdFusion - Connection timeouts on bulk cfhttp requests on Windows


While pumping lots of records / docs / bulk inserts to the new CouchDB Server i got a mysterious connection timeout that appeared always after about 4000+ inserted records.

By using cfhttp.errorDetail i got the error:

I/O Exception: Address already in use: connect

To save you some time here is what i found.

Starting with Windows 2003 Microsoft reduced the amount of connections to user ports. I did not check it but it seems that it will be the same behaviour in Windows 2008 and Vista. Here’s what Microsofts KB196271 says:

  1. Start Registry Editor.

  2. Locate the following subkey in the registry, and then click Parameters:

  3. On the Edit menu, click New, and then add the following registry entry:
    Value Name: MaxUserPort
    Value Type: DWORD
    Value data: 65534
    Valid Range: 5000-65534 (decimal)
    Default: 0x1388 (5000 decimal)
    Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically, ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive. After the release of security bulletin MS08-037, the behavior of Windows Server 2003 was changed to more closely match that of Windows Server 2008 and Windows Vista. For more information about Microsoft security bulletin MS08-037, click the following article numbers to view the articles in the Microsoft Knowledge Base:

    • KB951746: Description of the security update for DNS in Windows Server 2008, in Windows Server 2003, and in Windows 2000 Server (DNS server-side): July 8, 2008
    • KB951748: Description of the security update for DNS in Windows Server 2003, in Windows XP, and in Windows 2000 Server (client side): July 8, 2008
    • KB953230: Vulnerabilities in DNS could allow spoofing Exit Registry Editor, and then restart the computer.

OK, now relax.

If you've read this far you might as well follow me on Twitter here.