IIS 7 and Above
Error: "system lacked sufficient buffer space" / IIS 7.5
Last post Dec 07, 2018 04:00 PM by csiis
Nov 07, 2018 01:25 PM|csiis|LINK
We have a Windows 2008 R2 server running IIS 7.5. IIS has 2 separate sites; 1 which is the main website which is accessible from the Internet (which we'll call WEB1) and the 2nd which acts as a CDN, hosting images, CSS etc. which we'll call (WEB2)
WEB1 needs to call CSS from WEB2. Both sites reside on the same IIS server but are configured to run from different IP addresses. We use a local hosts file entry to facilitate WEB1's connection to WEB2. Every so often, WEB1 website falls over, with the following
being written as an error in event viewer:
System.Exception: Failed to retrieve content from CDN, looking for /css/xx.css with error System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An operation on a socket could not be performed
because the system lacked sufficient buffer space or because a queue was full WEB2:80
Does anyone have any ideas how we can resolve this, because it results in a complete website outage.
Many thanks in advance!
Nov 08, 2018 08:23 AM|Brando Zhang|LINK
According to your description, I guess your server may open a lot of prots when the web1 accsss web2. So it will show this error.
I suggest you could firstly run below command to see how many port has opened now to find out the reason.
Nov 08, 2018 03:36 PM|csiis|LINK
Thanks Brando, is there something that i can implement to fix this?
Nov 12, 2018 02:25 AM|Brando Zhang|LINK
In my opinion, we should firstly find out the reason why your application will take so many ports as TCP connection ports.
As far as I know, each connection will have a time delay.
If the application has already get the file, it will close the connection.
I suggest you could try to use web browser to access the application and then use F12 develop tool's netwrork tag to see how many connection has sent to the server.
If you still couldn't find out the reason.
I suggest you could try to reduce the TcpTimedWaitDelay parameter in your server.
The TcpTimedWaitDelay parameter:
Determines the time that must elapse before TCP can release a closed connection and reuse its resources. This interval between closure and release is known as the TIME_WAIT state or 2MSL state. During this time, the connection can
be reopened at much less cost to the client and server than establishing a new connection.
Reducing the value of this entry allows TCP to release closed connections faster, providing more resources for new connections. However, if the value is too low, TCP might release connection resources before the connection is complete,
requiring the server to use additional resources to reestablish the connection.
TcpTimedWaitDelay can be modified by regedit at HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters. It contains the number of seconds to wait. The default is 240 seconds (4 minutes). Reboot is required if changed.
Nov 12, 2018 08:45 AM|csiis|LINK
Thanks Brando, very useful. I'll go ahead and establish how many ports our application opens and why.
We made the following change, which appears to have stopped the issue from reoccurring -
Dec 05, 2018 11:10 AM|csiis|LINK
Ok, so we have had the issue return even though we implemented the previous registry change where we increased the amount of ports that can be used.
Is there anything we can run to establish how many ports are being used by the application?
Dec 05, 2018 07:47 PM|lextm|LINK
System.Exception: Failed to retrieve content from CDN, looking for /css/xx.css with error System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An operation on a socket could not be performed because the system
lacked sufficient buffer space or because a queue was full WEB2:80
Why should a web site back end code on IIS calls another site for CSS files? Ask your developers of the web app to change the code.
CDN links in a web page are used to inform the web browser where to locate such files, and such links should only be accessed by browsers. If the developers stick to such a simple rule, then this exception should never happen, and you also get rid of tons
of unnecessary loopback traffic.
Dec 07, 2018 04:00 PM|csiis|LINK
Very interesting. Thank you.
Aside from this, are you aware of anything other than the previous registry change made that could help in this situation?