0X00002747

WSAENOBUFS 0X00002747: No Buffer Space Available

Network & Connectivity Intermediate 👁 14 views 📅 Jun 22, 2026

Your system ran out of memory for network buffers. Happens often on Windows with too many connections or small default buffer pool.

Cause #1: Too Many Open Sockets — The Buffer Pool Is Starved

WSAENOBUFS (0X00002747) isn't a random error. What's happening is your Windows machine has exhausted the kernel's non-paged pool memory reserved for socket buffers. Each socket you open grabs a small chunk. Open enough of them — often from a server process that's not closing connections properly — and the pool runs dry.

This hits hardest on Windows Server 2016 and 2019, but I've seen it on Windows 10 too. A real-world trigger: a .NET web service that keeps HTTP connections alive without recycling them. After a few thousand requests, boom — 0X00002747.

The Fix: Increase the Buffer Pool via Registry

Skip the vague advice about restarting. The real fix is to grow the non-paged pool that Winsock uses. Here's how:

  1. Open Regedit as Administrator.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters
  3. Create a DWORD (32-bit) called DefaultReceiveWindow and set it to 65535 in decimal.
  4. Create another DWORD called DefaultSendWindow and set it to 65535 in decimal.
  5. Reboot. This doubles the default buffer from 8KB to 64KB per socket.

Why step 3 works: Winsock uses a shared pool of pre-allocated buffers. By raising the default window sizes, you're telling the kernel to reserve more memory upfront. The pool grows, and your app doesn't hit the ceiling as fast.

Cause #2: Ephemeral Port Exhaustion

Less common but sneaky. Windows by default gives you about 16,384 ephemeral ports (range 49152-65535) for outgoing connections. Each port uses a small buffer. If your app opens and closes connections fast — like a scraper or load tester — you can burn through those ports. The OS holds them in TIME_WAIT state for 4 minutes. Once they're gone, new connections fail with WSAENOBUFS.

Check this with netstat -an | find "TIME_WAIT". If you see over 10,000 entries, this is your problem.

The Fix: Expand the Port Range and Shorten TIME_WAIT

netsh int ipv4 set dynamicport tcp start=10000 num=55535
netsh int ipv4 set dynamicport udp start=10000 num=55535

This gives you 55,535 ports instead of 16,384. Run as Administrator. No reboot needed.

If you're still hitting it, shorten TIME_WAIT via registry:

  1. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
  2. Create a DWORD TcpTimedWaitDelay. Set it to 30 in decimal (seconds). Default is 240.
  3. Reboot.

The trade-off: lowering TIME_WAIT can cause old packets to mix with new connections on the same port. But for local dev or controlled servers, it's fine.

Cause #3: Memory Pressure from the Application Itself

Sometimes the OS isn't the culprit — your app is. If your code allocates socket buffers but never releases them (a memory leak), the process heap grows until it chokes. WSAENOBUFS gets thrown when the process can't commit more memory for Winsock.

I debugged a Node.js server once that did this. The event loop was holding references to closed sockets. The garbage collector never freed them. Leak.

The Fix: Profile and Close Properly

On Windows, use Process Explorer (from Sysinternals) to watch the "Handle Count" column for your app. If it climbs steadily, you've got a leak.

In code, make sure every socket() or accept() call has a matching closesocket() in the error path too. In C#, wrap sockets in using blocks. In Python, use with socket.socket() as s:. The garbage collector won't save you from socket leaks — you must close them explicitly.

One more thing: check if your app uses SO_SNDBUF or SO_RCVBUF with huge values. Setting them above 256KB per socket can exhaust the pool fast. Stick to defaults unless you know what you're doing.

Quick-Reference Summary Table

CauseFixTime to Apply
Too many sockets, buffer pool starvedRegistry: increase DefaultReceiveWindow and DefaultSendWindow to 6553515 min (with reboot)
Ephemeral port exhaustionnetsh to expand port range; optionally lower TcpTimedWaitDelay5 min (no reboot for netsh)
Application memory leakFix code to close sockets; reduce SO_SNDBUF/SO_RCVBUFVariable

If none of these work, check your antivirus. Some network filters (like McAfee or Norton) inject their own socket layer and consume buffers. Disable it temporarily to test. That's a fringe case, but it happens.

Was this solution helpful?