Commit Graph
6 Commits
Author SHA1 Message Date
Hasan BasbunarandClaude Opus 5.5 756e678b9e tests: the proxy's new ones take their ports from localports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 09:47:07 +01:00
Hasan BasbunarandClaude Opus 5.5 dbd1994b8b proxy v6.63: a connection past a ceiling is told so, with no thread for it
Past PROXY_MAX_CONN_PER_ADDRESS or PROXY_MAX_REMOTE_CONN a connection was
closed before it was read, and its client saw an empty reply (curl: "(52) Empty
reply from server", 2026-11-30), the cause in the box's journal alone. The
accept loop writes a short 503 with Retry-After and the settings' names, with
no thread and no wait, and closes it a second later, 32 at most at once, so
that a request on its way is not answered with a reset that takes the 503 back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 09:33:19 +01:00
Hasan BasbunarandClaude Opus 5.5 04ed571398 proxy v6.63: with no descriptor left, accept() waits, says so, and the unit has 65,536
accept() then fails at once and leaves its connection in the queue, and the
proxy came back to it in a loop with no pause: a core at 100 % and no line in
the journal, every client waiting (measured under ulimit -n 64, 2026-11-30). It
pauses and says it once a minute. systemd's own limit was 1,024 descriptors,
two a request in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 09:33:19 +01:00
Hasan BasbunarandClaude Opus 5.5 4db8586256 proxy v6.46: a network peer's headers and body are bounded, and the open routes take no body
The standard parser bounds each header line (64 KiB) and their number (100), not their
sum: about 6.4 MiB for each connection the ceilings allow, before any key (D03 of the
2026-10-24 security review). A peer on the network now has HEADER_BYTES_MAX (64 KiB) for a
request's line and headers in all, counted on what each readline returns, and gets 431
past it. The largest the box's eight clients sent, through a relay on 2026-10-24, was 952
bytes (Claude Code on /v1/messages, 21 headers).

/health, /ready and /metrics take no key, and a body sent there was read whole, up to
BODY_SMALL_BYTES with nothing taken from the budget; and a body read under CLIENT_IO_S held
its thread and its room in the budget for 900 s a byte (D04). A body on those routes is
refused unread (413, a new outcome the cockpit reads as a failure), and a network peer's
body that sends no byte for BODY_STALL_S (30 s) is let go with its room given back at once.
Only while the body comes in: the prefill and the answer come after it, and the proxy then
reads nothing from the client but its leaving. Loopback keeps CLIENT_IO_S and has no header
budget. Hasan chose 64 KiB and 30 s (2026-10-24).

The new tests fail on the old tree (2 in test_proxy_connection_ceiling.py, 5 in
test_proxy_body_budget.py, the closed outcome list in dashboard/tests/test_lifecycle.py);
the 34 proxy test files and the cockpit's feed tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:03:39 +02:00
Hasan BasbunarandClaude Opus 5.5 84e3a30e6d proxy: a peer on the network has 30 s in all for its request's headers
No key is asked before a request's line and headers are in, and
CLIENT_IO_S (900 s) bounded each read, not the whole: four addresses at
their ceiling of silent or trickling connections shut the port to every
other peer on the network, with no key. A connection from the network now
has CLIENT_HEADER_S (30 s, settable) in all until its headers are in, a
byte at a time or not, then CLIENT_IO_S again. Loopback is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 02:11:24 +02:00
Hasan BasbunarandClaude Opus 5.5 c2787090d5 proxy: bound the connections a peer on the network can hold open
Every connection held a thread and a descriptor for up to CLIENT_IO_S
(900 s) before its request line was read, with nothing counting them, so
any peer reaching the port without a key could exhaust the descriptors
and lock every client out. Connections from other machines now count
against a ceiling per address (PROXY_MAX_CONN_PER_ADDRESS, 64) and one
for the network (PROXY_MAX_REMOTE_CONN, 256), and past either the new
connection is closed before a thread starts, as the cockpit's relay does.
Loopback is not counted, so clients on the box keep the port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 02:11:24 +02:00