Skip to content

Lab

The accept queue

A program calls listen(2) with a The length of the accept queue that a program asks for in listen(2). The queue keeps each connection that the program did not accept., and the kernel keeps each new connection in the accept queue until the program accepts it. When the program stops its accepts, the queue fills. A full queue drops a SYN with no answer, and it drops the final ACK of a handshake. This page computes, in your browser, how many connections the queue holds, and how each connect ends.

What does a full queue do?

The queue holds 5 connections. At 30 ms, the final ACK of connect 2 overflows, but the client is connected. The client stays connected to nothing.

The settings of the cell AQ.5: a queue of 5 with 4 in it, and a burst of three connects. The client sends nothing.

The program does not accept0 s100 ms500 ms1 s2 s5 s10 s20 s60 sQueueThe accept queue: 30 msknows 30 msThe new connects dial: 0 sThe queue is full: 5 connections: 30 msThe final ACK of connect 2 overflows: 30 msSYNnever knowsFinal ACKcannot see the faultConnect 2 sends its SYN: 0 sThe client is connected: 20 msThe final ACK overflows: 30 msSYN-ACK 2: 1.01 sSYN-ACK 3: 3.01 sSYN-ACK 4: 7.01 sSYN-ACK 5: 15.01 sSYN-ACK 6: 31.01 sThe target forgets the request: 63.01 s
  • the fault
  • the lane acts, in this band
  • recovers
  • a send again or a timer
  • a probe
  • measured median of a cell

The axis is logarithmic, thus the first second and the last hour both fit.

  1. The accept queueThe length of the accept queue that a program asks for in listen(2). The queue keeps each connection that the program did not accept.

    First · Knows at 30 ms

    listen(2) gets 4, thus the queue holds 5. The first overflow comes at 30 ms: the final ACK of connect 2.

    listen(2) gets
    4
    The limit, after somaxconn
    4
    A full queue holds
    5
    In the queue at 0 s
    4
    New connects that find a place
    1
    SYNs that drop
    0
    Final ACKs that overflow
    2
    listen(2) gets
    The length of the accept queue that a program asks for in listen(2). The queue keeps each connection that the program did not accept.
    A sysctl: the largest backlog. A larger backlog in listen(2) gets this value. The default is 4096.
    In the queue at 0 s
    New connects
    The connects come
    The program accepts
  2. A SYN at a full queueA sysctl: the count of SYNs that a connect sends again before ETIMEDOUT. The default 6 gives 131 s.

    Never knows

    No SYN finds the queue full.

    tcp_syn_retries
    6
    tcp_syn_linear_timeouts
    4
    The clock of the kernel: the ticks in each second. A timer fires on a tick, thus it can be late by one tick or more.
  3. A final ACK at a full queueA sysctl: 1 answers a final ACK at a full queue with a reset. The default 0 drops the ACK and keeps the request.

    Cannot see it

    The client is connected at 20 ms, but its final ACK overflows. The target forgets the request at 63.01 s. The client sends nothing, thus it stays connected to nothing.

    The client is connected at
    20 ms
    SYN-ACKs that go again
    5
    The target forgets the request at
    63.004 s to 64.738 s
    The first send of the client
    none
    tcp_abort_on_overflow
    0
    tcp_synack_retries
    5
    A sysctl: 1 answers a final ACK at a full queue with a reset. The default 0 drops the ACK and keeps the request.
    The client sends
  • The headline tells the first overflow of the queue and how its connect ends.
  • The timeline has three lanes. The queue lane shows when the queue is full and the first overflow. The SYN lane follows the first connect whose SYN drops. The final ACK lane follows the first connect whose final ACK drops. Press Play to see the story.
  • The cards below the timeline give each lane, with its knobs. Change a knob, and each time on the page changes.
  • The presets are the settings of the cells AQ.1 to AQ.10 of the harness.
  • The measured values below give each cell as the runners of GitHub measured it. Each row is one term of the law, with its band and its median.

listen(2) clamps the backlog to A sysctl: the largest backlog. A larger backlog in listen(2) gets this value. The default is 4096., and this value is the limit of the queue. A full queue holds the limit plus one, because the kernel tests for more than the limit. Thus a backlog of 4 holds 5 connections, and a backlog of 0 holds 1.

Node gives listen(2) 511 for a backlog of 0. Thus a server on Node that declares 0 holds 512 connections.

  • A SYN at a full queue drops with no answer. The client sends its SYN again on its ladder: 1 s for each of the first five waits, then 2, 4, 8, 16, 32 and 64 s. With A sysctl: the count of SYNs that a connect sends again before ETIMEDOUT. The default 6 gives 131 s. 6, the connect ends with The error that the kernel gives to the socket when TCP stops a connection on a timer. at 131 s.
  • A final ACK at a full queue comes after the client is connected. With A sysctl: 1 answers a final ACK at a full queue with a reset. The default 0 drops the ACK and keeps the request. 1, the target sends a reset, and the client gets The error that the kernel gives to the socket when a reset from the peer ends the connection. one round trip later.
  • With tcp_abort_on_overflow 0, the target drops the ACK and keeps the request. It sends its The answer of the target to a SYN, the second packet of the handshake. again at 1, 3, 7, 15 and 31 s. At 63 s it forgets the request.

After the expiry, the next segment of the client meets the listener, and it gets a reset. A client that sends nothing stays connected to nothing. When the program accepts before the expiry, the next SYN-ACK gets a The answer of a connected client to a SYN-ACK that comes again: an ACK that tells the target the state of the client. from the client, and that ACK finds a place.

Each cell fills a real queue on a runner of GitHub, and the harness measures each term of its law. The band of a term is the prediction of the cell. The median is the middle value of the counted trials. A median outside its band shows as a failure. A cell with no record keeps its place.

The runners of GitHub measured these cells on 2026-11-16, on the kernel 7.0.0 with HZ 1000, at the commit 43219db.

AQ.1 the count: a backlog of 4 under a somaxconn of 4096 holds 5
holds

listen(2) clamps the backlog to somaxconn, and the queue holds the limit plus one. Each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.1: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue444444
the most in the queue555555
the connects that succeed555555
the overflows222222
the resets of the target000000
AQ.2 the count: somaxconn 8 clamps a backlog of 511, and the queue holds 9
holds

listen(2) clamps the backlog to somaxconn, and the queue holds the limit plus one. Each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.2: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue888888
the most in the queue999999
the connects that succeed999999
the overflows222222
the resets of the target000000
AQ.3 the count: a backlog of 0 holds 1
holds

listen(2) clamps the backlog to somaxconn, and the queue holds the limit plus one. Each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.3: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue000000
the most in the queue111111
the connects that succeed111111
the overflows222222
the resets of the target000000
AQ.4 a SYN at a full queue meets the SYN ladder of the client, and ETIMEDOUT
holds

The kernel drops each SYN at a full queue with no answer. Each of the 11 SYNs is one overflow, and the connect ends on the timer of the client.

None of the 4 counted runs measured a time.

AQ.4: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue111111
the most in the queue222222
the connects that succeed222222
the overflows111111111111
the resets of the target000000
ETIMEDOUT at the blocked connection130.99 s to 137.09 s134.51 s134.44 s134.59 s134.88 s134.04 s
AQ.5 a final ACK at a full queue: the client connects, the target forgets it at 63 s, and the next segment meets a reset
holds

tcp_abort_on_overflow 0 keeps the request and drops the final ACK. The client is ESTABLISHED, and only a later segment tells it the truth. The count of overflows depends on the retransmissions of the client, thus it has a floor and no band.

None of the 4 counted runs measured a time.

AQ.5: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue444444
the most in the queue555555
the connects that succeed777777
the overflows2 to 1,0002222222222
the resets of the target000000
the expiry of the requests62.98 s to 64.74 s64.08 s63.83 s64.09 s64.3 s64.06 s
ECONNRESET at the busy connection110 s to 125 s115.92 s117.6 s114.29 s117.56 s114.25 s
ECONNRESET at the quiet connection0.01 s to 0.05 s0.02 s0.02 s0.02 s0.02 s0.02 s
AQ.6 a final ACK at a full queue with tcp_abort_on_overflow 1: connected, then ECONNRESET one round trip later
holds

tcp_abort_on_overflow 1 answers an overflow of a final ACK with a reset. A SYN at a full queue stays silent, because the sysctl does not change that path.

None of the 4 counted runs measured a time.

AQ.6: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue444444
the most in the queue555555
the connects that succeed777777
the overflows333333
the resets of the target222222
ECONNRESET at the busy connection0.01 s to 0.05 s0.02 s0.02 s0.02 s0.02 s0.02 s
ECONNRESET at the quiet connection0.01 s to 0.05 s0.02 s0.02 s0.02 s0.02 s0.02 s
AQ.7 the queue drains before the expiry: the next SYN-ACK brings a challenge ACK, and no connection fails
holds

The request stays until its expiry. The SYN-ACK at 3 s gets a challenge ACK, and that ACK finds a place. The blocked SYN finds a place at its next firing. The count of overflows depends on the retransmissions before the accept, thus its band is wide.

None of the 4 counted runs measured a time.

AQ.7: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue444444
the most in the queue555555
the connects that succeed888888
the overflows9 to 151212121212
the resets of the target000000
the accepts888888
the queue back to 43.01 s to 3.16 s3.08 s3.08 s3.08 s3.14 s3.07 s
AQ.8 the count of service 0.7: a declared backlog of 4 under a somaxconn of 4096 holds 5
holds

listen(2) clamps the backlog to somaxconn, and the queue holds the limit plus one. Each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.8: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue444444
the most in the queue555555
the connects that succeed555555
the overflows222222
the resets of the target000000
AQ.9 the count of service 0.7: somaxconn 8 clamps a declared backlog of 511, and the queue holds 9
holds

listen(2) clamps the backlog to somaxconn, and the queue holds the limit plus one. Each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.9: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue888888
the most in the queue999999
the connects that succeed999999
the overflows222222
the resets of the target000000
AQ.10 the count of service 0.7: Node gives listen(2) 511 for a declared backlog of 0, and the queue holds 512
holds

Node gives listen(2) 511 for a backlog of 0, thus the declared 0 of service 0.7.3 is a limit of 511. The queue holds the limit plus one, and each later SYN is one overflow.

None of the 4 counted runs measured a time.

AQ.10: the band of each term of the law, the median of the counted runs and each run.
TermBandMedianTrial 1Trial 2Trial 3Trial 4
the limit of the queue511511511511511511
the most in the queue512512512512512512
the connects that succeed512512512512512512
the overflows222222
the resets of the target000000

The count is the law of acceptQueueLimit and acceptQueueHeld of @mark1russell7/algebra. The ladders come from the timers of the document of Linux TCP, LINUX_TCP of @mark1russell7/machines: syn_retransmit, syn_giveup, synack_retransmit, synack_giveup and retransmit.

Each timer fires on a tick of The clock of the kernel: the ticks in each second. A timer fires on a tick, thus it can be late by one tick or more., thus each firing can come late. The band of a time on the page is the sum of how early and how late each wait before it can fire. Each amount prints through format of @mark1russell7/quantity. The page does no timer arithmetic of its own.

  • The page puts one half of the round trip on each way of the path.
  • From the accept, the page gives a place to each packet. A program that accepts slowly frees one place for each accept.
  • When the queue of requests is full, the target sends a An answer to a SYN when the queue of requests is full. The target keeps no request and finds the connection in the final ACK.. The page counts the cookie, but it does not show its later steps.
  • A client that sends data stops after A sysctl: the number of RTO retransmissions before TCP stops the connection. The default is 15, approximately 15 min.. The page shows the first segment after the expiry, which comes well before that end.