Linux SYN Backlog Drops, Ephemeral Port Exhaustion & TCP BBR
Diagnose silent TCP SYN queue drops, TIME_WAIT ephemeral port exhaustion (EADDRNOTAVAIL), and Cubic packet-loss collapse with ss, nstat, and sysctl tuning.
During traffic bursts, clients see 1-second or 3-second connection stalls and proxy logs emit "Cannot assign requested address (EADDRNOTAVAIL)" while host CPU is under 40%.
rate(node_netstat_TcpExt_ListenOverflows[5m]) > 0 OR rate(node_netstat_TcpExt_ListenDrops[5m]) > 0When an application calls listen(fd, backlog) with a small backlog (historically 128 or 511) or kernel net.core.somaxconn is too low, burst arrivals overflow the accept queue. Linux silently drops incoming ACKs/SYNs, forcing clients into a 1s -> 3s TCP retransmission backoff.
Outbound proxies opening short-lived TCP connections to a single upstream IP:port exhaust the default ~28,000 ephemeral port range (32768-60999) in TIME_WAIT (60s), throwing EADDRNOTAVAIL.
Over WAN links with 1-2% packet loss, default TCP CUBIC cuts cwnd aggressively on every single loss event, whereas TCP BBR paces traffic from bottleneck bandwidth and min-RTT measurements.
You raised net.core.somaxconn to 16384, yet ss -lnt still shows Send-Q = 511 on Nginx port 443 and TcpExtListenOverflows keeps climbing. Why?
- Confirm both sysctl net.core.somaxconn AND the application listen(..., backlog) parameter are raised (the kernel uses min of the two).
- Verify nstat -az TcpExtListenOverflows stops incrementing under synthetic burst load.
- Eliminate TIME_WAIT churn at the root by enabling HTTP/1.1 keepalive pooling to upstreams.
Why does TCP BBR require net.core.default_qdisc=fq?
BBR relies on precise packet pacing to avoid filling router buffers; the Fair Queue (fq) qdisc implements kernel-level per-flow pacing cleanly.
Is net.ipv4.tcp_tw_reuse=1 safe for outbound proxy connections?
Yes (for outbound client sockets only, when TCP timestamps are enabled), though enabling HTTP/1.1 keepalive pooling is always the primary fix for ephemeral port exhaustion.
How do I tell if file descriptors (EMFILE) vs ports (EADDRNOTAVAIL) failed?
EMFILE ("Too many open files") means per-process RLIMIT_NOFILE is exhausted (check /proc/<pid>/limits); EADDRNOTAVAIL means the 4-tuple ephemeral port space to that upstream IP:port is full.