concept Linux & administration
TCP SYN backlog versus accept queue
On Linux, incomplete TCP handshakes and completed connections waiting for accept are different queues. A full accept queue tells you how many are waiting, not whether a connection failed.
What it means
On Linux, the SYN backlog concerns connection requests whose TCP handshake is still incomplete. The accept queue holds connections whose handshake has finished but which the listening application has not yet taken with accept(). Pressure at the first stage concerns handshakes still in progress; pressure at the second concerns completed connections waiting for the application. Saying “the backlog is full” leaves out which stage is full.
Try it
Simulation: Change Application accept events in interval from 1 to 0, leaving everything else unchanged. Watch how many newly completed connections fit, not just how many connections are waiting at the end. The counts are synthetic; no traffic is sent.
TCP SYN backlog versus accept queue
Explain why a listener can stall in handshake or accept stages for different reasons
A scoped queue is full, an arrival is not admitted, or cookie fallback is reported active. These stipulated observations do not identify the cause of a real connection failure.
Accept interval
- Accepted by app1
- Not admitted0
Pressure evidence
- SYN bound reachedNo
- Accept bound reachedYes
- Cookie fallback evidencenot-observed
- Outcomepressure
These are independent occupancies and interval events, not a single queue or an observed client failure. Active cookie fallback can itself trigger the pressure branch.
Evaluated inputs
- Required scenario evidence
- provided
- Counter interpretation
- known
- Observed incomplete handshakes
- 6 count
- Stipulated incomplete-queue bound
- 8 count
- Observed completed connections awaiting accept
- 5 count
- Stipulated accept-queue bound
- 6 count
- Application accept events in interval
- 1 count
- Observed newly completed handshakes in interval
- 2 count
- Fallback evidence
- not-observed
Linux context, tiny retrospective synthetic occupancies, app drain then new completed observations in one interval. No packet generation, attack traffic, tuning values, handshake retry/overflow semantics, cookie implementation or actual kernel queue measurement. Equality is full, not proof of a failed connection. Cookie fallback is observed, not a capacity recommendation.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
Start with 6 incomplete handshakes against a bound of 8. Separately, 5 completed connections are waiting in an accept queue with 6 places. Two more handshakes complete during the interval. The simulation applies the application's accepts first, then counts how many of the two new completions fit.
| Accept queue in this interval | 1 accept | 0 accepts |
|---|---|---|
| Connections still waiting after accepts | 4 | 5 |
| Places available for new completions | 2 | 1 |
| New completions that fit | 2 | 1 |
| New completions that do not fit | 0 | 1 |
| Connections waiting at the end | 6 | 6 |
Both results say pressure, and both end with a full accept queue. With one accept, the last completion takes the last place. Without that accept, one completion has no place in the modeled queue. A final count of 6 alone cannot tell you which happened. Nor is a completion that does not fit in this simulation a measured client failure. Reset restores the starting counts and evidence choices.
Reading the two queues separately
The backlog argument to Linux listen() applies to established connections waiting for acceptance. Linux documents a separate per-listener limit for remembered incomplete requests. An application accept removes a connection from the completed queue; it does not remove an incomplete handshake. In the simulation, the incomplete count is a separate observation, not a running total from which to subtract the two new completions.
Consider an interval with one accept but no new completions. The application takes one of the five waiting connections, leaving 4 of 6 places occupied. With 6 of 8 incomplete handshakes and no cookie fallback observed, the result is room. Change just the incomplete count to 8: the result becomes pressure even though the accept queue still has two free places. Space at one stage does not settle whether there is space at the other.
SYN cookie fallback is a separate piece of evidence. In the simulation, an observation of active fallback counts as a pressure signal; it does not add places to the accept queue or identify the cause of the pressure. “Not observed” describes the evidence for this interval, not whether the feature is enabled. If fallback evidence or the meaning of the counters is unknown, the simulation withholds a queue verdict.
A pressure signal need not come from either bound. With 6 incomplete requests against 8, one application accept, no new completions and 4 completed requests remaining against 6, select active cookie fallback. The branch is pressure even though both occupancy bars have room. The scene shows the separate fallback observation rather than claiming that a queue is full. This is a stipulated signal, not a diagnosis of attack traffic.
In practice
Use existing observations you are authorized to inspect; do not generate connection pressure to test a listener. For the same listener and time interval, distinguish counts of connections waiting from counts of events: how many handshakes were incomplete, how many completed connections were waiting, how many handshakes finished, and how many connections the application accepted. The last two counts give context that a single queue snapshot cannot.
If the Linux version, counter meanings, or relevant observations are unknown, stop before assigning a cause or proposing a configuration change. The simulation neither measures a kernel queue nor predicts retries, overflow behavior, or what a client experienced. Its small bounds are not tuning values.
Start with the wait you can establish. Evidence of incomplete handshakes points you toward the handshake stage. If connections have already completed and are waiting, compare completions with application accepts. A timeout by itself does not make that distinction.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Does accept complete the TCP handshake?
No in the ordinary Linux listening-socket example: the completed connection may already be queued for the application’s accept call.
Are the incomplete and completed queues limited by the same setting?
Not generally. Linux documents a per-listener incomplete-request limit separately from the listen backlog for completed connections.
Does a SYN cookie observation prove an attack?
No. The documented cookie mechanism can be a fallback under pressure; configuration can also affect when it is used. Active fallback alone is a pressure premise here, not evidence that a specific queue is full or an attack occurred.
Does a timeout prove either queue is full?
No. Collect authorized listener and kernel observations with the actual version and counter interpretation, and distinguish transport from application delay.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- listen(2)
DESCRIPTION; NOTES (Linux backlog semantics). Linux distinguishes completed sockets waiting for accept from incomplete connection requests. somaxconn caps the effective completed backlog.
Checked .
- Linux kernel IP Sysctl documentation
tcp_max_syn_backlog; tcp_syncookies. The incomplete-request queue is distinct from the listen backlog. SYN cookies are a fallback, not a capacity tuning guarantee for legitimate demand.
Checked .