Thursday, October 22, 2015

Windows Server 2003 / 2008: Lack of sufficient buffer space or queue was full

So users had issues with connections to SharePoint 2010 on a Windows Server 2008. The only thing they were able to tell we was a Correlation ID, which still is the best starting point you can imagine. The log, of course, was a mess with errors, the most interesting was this one:
System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.)
And also:
SqlError: 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.)' Source: '.Net SqlClient Data Provider' Number: 10055 State: 0 Class: 20 Procedure: '' LineNumber: 0 Server: ''

Also some issues with a connection string.
ConnectionString: 'Data Source=SERVERNAME\INSTANCE,PORT;Initial Catalog=DATABASE;Integrated Security=True;Enlist=False;Asynchronous Processing=False;Connect Timeout=15' ConnectionState: Closed ConnectionTimeout: 15

Now that we got that error: How do we fix it? And what went wrong?
First you have to take a look at the available dynamic ports:

The output will look something like this:
Depending on the system you are running and the amount of users you have to support, well: this might not be enough and will explain the errors above.
Let's fix this:

"start=" defines the first dynamicport that could be used. The "num=" defines the range, in my case I got 1000 Ports available, starting with 49152. That's a lot more and should allow more users to connect. If you still get the error, but not as often as you used to, just set the range higher, I think the range is up to 16384, because that's the range of dynamic, private and ephemeral ports.

As a little knowledge nugget: How to do this on Windows Server 2003 and older?
Go to the registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters, check if there is a "MaxUserPort" entry there. If not, create a DWORD, the standard value is 5000 (decimal) oder 0x1388 (hex), you can enter values up to 65534 (decimal). This will define the highest available TCP/IP port, starting with the first port 1024. So: "MaxUserPort" - 1024 = available dynamic ports.

No comments:

Post a Comment