`dmesg` shows `TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies.`
IntermediateTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer
Likely causes → The SYN (half-open) queue for that listener overflowed and the kernel fell back to SYN cookies. Either it's a real SYN flood, or a legitimate burst (deploy, reconnect storm) with a small backlog. SYN cookies keep you up but drop TCP options such as window scaling in some cases.
Diagnose →
nstat -az | grep -E 'TcpExtSyncookiesSent|TcpExtListenOverflows|TcpExtListenDrops'
ss -ltn 'sport = :443'
sysctl net.ipv4.tcp_max_syn_backlog net.core.somaxconn net.ipv4.tcp_syncookies
sudo tcpdump -ni eth0 'tcp[tcpflags] == tcp-syn and dst port 443' -c 200 | awk '{print $3}' | sort | uniq -c | sort -rn | head
Many distinct spoofed sources that never complete the handshake means a flood.
Fix → For bursts: raise tcp_max_syn_backlog, somaxconn and the app's listen() backlog (nginx listen 443 ssl backlog=4096;). For floods: put DDoS protection (AWS Shield, Cloudflare) or an L4 LB in front; keep tcp_syncookies=1.
Prevent → Alert on SyncookiesSent and ListenDrops rates.
More on Sockets, ports, TIME_WAIT and conntrack
`dmesg` is full of `nf_conntrack: nf_conntrack: table full, dropping packet` and new connections randomly time out.Intermediate`ss -s` on a reverse proxy shows 40,000 sockets in `TIME_WAIT`. Is that a problem?BeginnerAn app server's `CLOSE_WAIT` count grows steadily until the service logs `Too many open files`.IntermediateLogs show `accept4(): Too many open files` and the service stops accepting connections.Beginner`ss -ltn` shows the listener for port 8080 with `Recv-Q 129` and `Send-Q 128`, and clients hang on connect.AdvancedA blog post told you to set `net.ipv4.tcp_tw_recycle=1`, but `sysctl` returns `cannot stat /proc/sys/net/ipv4/tcp_tw_recycle`.Beginner