About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
The kernel log line TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies. (the form at tags v4.19 to v6.1, which also ends with "Check SNMP counters.") means one listening socket's queue of half-open connection requests filled up, and the kernel switched to SYN cookies for new requests. It does not prove an attack. The kernel documentation says an investigation may show the warnings "occur because of overload with legal connections". Compare who is in SYN_RECV, read the kernel counters, then size the listen backlog.
What the message means
A TCP connection starts with a SYN from the client. The server's kernel answers with a SYN-ACK and keeps the half-open request until the client's final ACK arrives. The ss manual lists syn-recv as a TCP state name, and the kernel documentation calls the remembered connection requests "(SYN_RECV)". Each listening socket has a limited queue for them. In the kernel source code at tag v7.3 the request queue counts as full when its length exceeds the listening socket's maximum backlog, the value the application passed to listen() after the kernel's cap is applied.
When that queue is full, the kernel source in tcp_syn_flood_action does three things. On a kernel built with syncookie support, it chooses the text "Sending cookies" if tcp_syncookies is not 0, or "Dropping request" if it is 0. It counts the event in a kernel counter. It prints the warning once for that listening socket and not again for the same socket; with tcp_syncookies set to 2 the source prints no warning at all. The warning is printed through a rate-limited info call, so a quiet log later does not mean the pressure ended.
The text comes from the kernel's source code (net/ipv4/tcp_input.c) and differs by kernel. At tags v4.19, v5.4 and v6.1 the format is %s: Possible SYN flooding on port %d. %s. Check SNMP counters. At tag v7.3 the IPv4 format is %s: Possible SYN flooding on port %pI4:%u. %s., which carries the address as well, and the "Check SNMP counters" sentence is gone. The TCP: at the start of the log line is not in those formats; the source file adds it to every message it prints. In the formats, the first %s is request_sock_ plus the protocol name (TCP for IPv4 TCP), the port is the listening port (at tag v4.19 the destination port of the incoming SYN, from tag v5.4 the socket's own port). From tag v7.3 the address is shown as well. The last %s is either Sending cookies or Dropping request. Those are the parts that vary.
The kernel documentation for tcp_syncookies (default 1) says: "Send out syncookies when the syn backlog queue of a socket overflows." It also says "syncookies is fallback facility. It MUST NOT be used to help highly loaded servers to stand against legal connection rate." If the cause is load, the instruction is "you should tune another parameters until this warning disappear."
How the limits combine
The listen(2) manual says the backlog "defines the maximum length to which the queue of pending connections for sockfd may grow", and "If the backlog argument is greater than the value in /proc/sys/net/core/somaxconn, then it is silently capped to that value." It also says: "Since Linux 5.4, the default in this file is 4096; in earlier kernels, the default value is 128." So the effective backlog is the smaller of the two:
- nginx default 511 on a kernel with
somaxconn4096: min(511, 4096) = 511. - nginx default 511 on a kernel before 5.4 with
somaxconn128: min(511, 128) = 128. backlog=1024withsomaxconn4096: min(1024, 4096) = 1024.
The listen(2) manual also says tcp_max_syn_backlog "is ignored" when syncookies are enabled. The kernel IP Sysctl page describes tcp_max_syn_backlog as a per-listener limit and says "If server suffers from overload, try increasing this number. Remember to also check /proc/sys/net/core/somaxconn". The tcp(7) manual gives its own default for tcp_max_syn_backlog: 256, raised to 1024 when the system has 128 MB or more of memory. The IP Sysctl page says "The minimal value is 128 for low memory machines, and it will increase in proportion to the memory of machine." tcp(7) and the IP Sysctl page give different defaults for tcp_max_syn_backlog, and listen(2) says it is ignored with syncookies, so the steps below change the listener's own backlog and the cap on it, not tcp_max_syn_backlog.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| A burst of legitimate connections beyond the backlog | Many syn-recv entries from addresses you recognise, such as a load balancer |
ss list by state and source; counters rise with the traffic |
| The application accepts connections slowly | ListenOverflows and ListenDrops rise too |
nstat counters; the application is saturated |
| The listen backlog is small | The application default is low, or the kernel cap is low | The application's backlog setting and net.core.somaxconn |
| A real SYN flood | Many syn-recv entries from spread or spoofed sources that never finish |
The sources are unexpected; counters climb without matching real traffic |
tcp_syncookies is 0 |
The message ends "Dropping request" | sysctl net.ipv4.tcp_syncookies |
Prove the cause before changing anything
All of these only read data.
1. Read the log line. Note the port, the kernel's wording ("Sending cookies" or "Dropping request") and the time.
2. Count half-open connections on that port. The ss manual lists syn-recv among the state names and sport as a predicate:
ss -Htn state syn-recv sport = :443 | wc -l
3. Look at who they are. Run the same command without wc -l, and read the peer addresses. The same few addresses you expect point to load. Many addresses you do not recognise suggest a flood.
4. Read the kernel counters. The nstat manual says -a dumps absolute values and -z shows zero counters. The counter names in the kernel source are TCPReqQFullDoCookies, TCPReqQFullDrop, ListenOverflows and ListenDrops; nstat shows them with the TcpExt prefix:
nstat -az TcpExtTCPReqQFullDoCookies TcpExtTCPReqQFullDrop TcpExtListenOverflows TcpExtListenDrops
The kernel SNMP documentation says that when the accept queue is full "kernel will drop the SYN and add 1 to TcpExtListenOverflows", and that TcpExtListenDrops also increases when the kernel drops a packet for a listening socket. Run the command twice, a minute apart, and compare.
5. Read the settings. The values behind the queue:
sysctl net.ipv4.tcp_syncookies net.ipv4.tcp_max_syn_backlog net.core.somaxconn
6. Read the application's backlog. For nginx, the listen directive takes backlog=number, which "sets the backlog parameter in the listen() call that limits the maximum length for the queue of pending connections", and "By default, backlog is set to -1 on FreeBSD, DragonFly BSD, and macOS, and to 511 on other platforms."
Fix
Raise the application's backlog (nginx example)
The backlog you choose should not be larger than net.core.somaxconn, because the kernel caps it there. The nginx documentation says the socket parameters "can be specified in any listen directive, but only once for a given address:port pair", so set backlog on only one listen line for each address and port. /etc/nginx/conf.d/app.example.com.conf below is an example name; use the file that holds your listen 443 line.
First save the current file:
cp -p /etc/nginx/conf.d/app.example.com.conf /etc/nginx/conf.d/app.example.com.conf.2026-11-22
Disruptive step: the next step edits the nginx configuration, and the reload after it replaces the worker processes. A valid change that is wrong for the site affects all of its visitors.
Add the parameter to the listen line for port 443, keeping your other parameters:
listen 443 ssl backlog=1024;
The nginx switches page says -t tests "the configuration file: nginx checks the configuration for correct syntax, and then tries to open files referred in the configuration" and -s reload will "reload configuration, start the new worker process with a new configuration, gracefully shut down old worker processes". Test, and reload only if the test succeeds:
nginx -t && nginx -s reload
To undo it: put the saved file back under its original name, test it, then reload. The first command stops the chain if the saved copy does not exist:
ls -l /etc/nginx/conf.d/app.example.com.conf.2026-11-22 && cp -p /etc/nginx/conf.d/app.example.com.conf.2026-11-22 /etc/nginx/conf.d/app.example.com.conf && nginx -t && nginx -s reload
Raise the kernel cap, only if the backlog you want is above it
If the value in net.core.somaxconn is lower than the backlog you chose, the kernel caps it.
First save the current value:
sysctl net.core.somaxconn > /root/somaxconn.2026-11-22
Risk: the next command changes the cap on the listen backlog for every program on the host until reboot.
Set a value at least as large as the backlog you chose. The sysctl manual says -w forces write arguments:
sysctl -w net.core.somaxconn=8192
To undo it: set the number saved in /root/somaxconn.2026-11-22 back with the same form, sysctl -w net.core.somaxconn= followed by the saved number. The setting applies to the running kernel only; keeping it across a reboot is a separate change to a file under /etc/sysctl.d.
What not to change
The kernel documentation calls syncookies a "fallback facility", and the tcp(7) manual says they are "not recommended as a tuning mechanism for heavily loaded servers". Neither page says to disable them or to leave them as they are, so tune the backlog first, as above. For tcp_abort_on_overflow the kernel documentation says: "Enable this option only if you are really sure that listening daemon cannot be tuned to accept connections faster. Enabling this option can harm clients of your server." No command for it is given here.
Example (illustrative): On web01 the kernel log reads TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies. Check SNMP counters. The command ss -Htn state syn-recv sport = :443 | wc -l prints about 510, and almost every peer is 198.51.100.5, the load balancer. Two nstat -az readings a minute apart show TcpExtTCPReqQFullDoCookies and TcpExtListenOverflows both rising. The nginx listen line has no backlog=, so the default 511 applies; sysctl net.core.somaxconn prints 4096, so the effective backlog is min(511, 4096) = 511. The engineer saves the file, sets backlog=1024, tests and reloads. The effective backlog is now min(1024, 4096) = 1024. The application owner also looks at why the workers accept slowly.
Confirm the fix
- Under the same load, both
nstat -azreadings show the four counters flat between two readings a minute apart. ss -Htn state syn-recv sport = :443 | wc -lstays well below the effective backlog.- Clients on the port report no stalls or resets.
What to watch afterwards
- A new warning for the same listening socket does not appear after the first one, so the counters are the better signal than the log line.
- Record the
syn-recvcount and the counters at peak load, and compare them with the effective backlog after every release. - If the sources are not yours, the fault is not capacity. Filtering at the network edge is beyond what a listener setting can do.
Read next
Related articles you may want next.
- Troubleshootingnf_conntrack: table full, dropping packet. Size the connection tracking table from your own countsnf_conntrack: table full, dropping packet in the kernel log. Compare nf_conntrack_count with nf_conntrack_max, find what fills it, then raise or tune it.Read article
- Troubleshootingnginx 504 Gateway Time-out: upstream timed out (110: Connection timed out) while reading response headernginx 504 Gateway Time-out and upstream timed out (110: Connection timed out) while reading response header. Find the slow phase and set timeouts safely.Read article
- TroubleshootingConnections drop after a few idle minutes through a firewall or load balancer: idle timers and TCP keepaliveTCP sessions die after the same idle time through a firewall or load balancer. Find the idle timer and set keepalive below it on Linux, nginx or SSH.Read article
Risks and limits
- These commands have not been run or lab-tested.
- Counter names are taken from the kernel source and nstat's
TcpExtprefix; the kernel SNMP documentation describesListenOverflowsandListenDropsbut not the twoTCPReqQFullcounters. - Message text and defaults differ by kernel version, as shown above. The kernel IP Sysctl page is the latest one and may not match the version on the host.
- A larger backlog uses more memory for queued connections and can hide an application that is too slow. Fix the slow accept as well.
Sources
- net/ipv4/tcp_input.c at v7.3 — Linux kernel source code at a fixed tag, no date shown, accessed 22 November 2026
- net/ipv4/tcp_input.c at v6.1 — Linux kernel source, no date shown, accessed 22 November 2026
- net/ipv4/tcp_input.c at v5.4 — Linux kernel source, no date shown, accessed 22 November 2026
- net/ipv4/tcp_input.c at v4.19 — Linux kernel source, no date shown, accessed 22 November 2026
- include/net/inet_connection_sock.h at v7.3 — Linux kernel source code at a fixed tag, no date shown, accessed 22 November 2026
- net/ipv4/proc.c at v7.3 — Linux kernel source code at a fixed tag, no date shown, accessed 22 November 2026
- net/core/sock.c at v6.1 — Linux kernel source, no date shown, accessed 22 November 2026
- IP Sysctl — The Linux Kernel documentation, latest (page header 7.4.0-rc3), no date shown, accessed 22 November 2026
- SNMP counter — The Linux Kernel documentation, latest, no date shown, accessed 22 November 2026
- listen(2) — Linux man-pages 6.19, 2026-02-11, accessed 22 November 2026
- tcp(7) — Linux man-pages 6.19, 2026-04-19, accessed 22 November 2026
- ss(8) — iproute2 manual page, no manual date shown, accessed 22 November 2026
- nstat(8) — iproute2 manual page, dated 27 June 2007, accessed 22 November 2026
- sysctl(8) — procps-ng 2024-07-19, accessed 22 November 2026
- Module ngx_http_core_module, listen — F5 / nginx.org, no date shown, accessed 22 November 2026
- nginx command-line parameters — F5 / nginx.org, no date shown, accessed 22 November 2026
This article was originally published on .