Skip to content

bench: a cell measured while the conntrack table was full is discarded - #289

Merged
MDA2AV merged 1 commit into
mainfrom
bench/conntrack-guard
Oct 12, 2026
Merged

MDA2AV merged 1 commit into
mainfrom
bench/conntrack-guard

Conversation

@MDA2AV

@MDA2AV MDA2AV commented Oct 7, 2026

Copy link
Copy Markdown
Owner

any.sh now discards a cell measured while the kernel's connection-tracking table was full.

With nf_conntrack loaded (Docker's NAT rules load it, as on the bench box), every connection, loopback included, keeps a table entry for 120 s after it closes. When the table is full the kernel drops new SYNs without reporting anything: clients sit in SYN-SENT, retransmit after a second, and the run reads as a slow or idle server. While measuring short-lived connections for #91, ad-hoc churn runs filled the 262,144-entry table within seconds whenever each run used new ports or addresses. Runs then came back at 0 conn/s, or half-utilised. nstat showed every SYN retransmit failing (TCPSynRetrans == TCPRetransFail) with no listen drops.

bench_conntrack_full in lib.sh reports the table once it is at 95% or more, and any.sh discards the cell the same way it discards one with socket errors or an unsaturated reactor. The README lists the new reason next to the SO_REUSEPORT one, with the workaround for ad-hoc churn tests: reuse one port and a few addresses, so the entries recycle.

Tests

Checked against fake count/max files: 94/100 is not flagged, 95/100 is flagged and prints 95/100, and a machine without conntrack is not flagged. This box (1137/262144) is not flagged. I did not fill the real table to demonstrate it, because that drops new connections machine-wide.

The keep-alive drivers any.sh uses don't open connections fast enough to hit this. The check guards the shape that does.

With nf_conntrack loaded (Docker's NAT rules load it) every connection, loopback included,
keeps a table entry for 120 s after it closes. Once the table is full the kernel drops new
SYNs silently: clients sit in SYN-SENT, retransmit, and the run reads as a slow or idle
server. Ad-hoc connection-churn tests on this box filled the 262144-entry table within
seconds whenever each run used new ports or addresses.

bench_conntrack_full (lib.sh) reports the table at 95% or more, and any.sh discards the cell
the way it already discards one with socket errors or an unsaturated reactor. README lists the
new reason next to the SO_REUSEPORT one.

Checked against fake count/max files: 94/100 not flagged, 95/100 flagged, no conntrack not
flagged; this machine (1137/262144) not flagged.
@MDA2AV
MDA2AV merged commit 8bc2ea6 into main Oct 12, 2026
1 check passed
@MDA2AV MDA2AV mentioned this pull request Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant