Watch
0
0
Fork
You've already forked hyperhive
0

bound the request line on the host admin and in-agent sockets

hive-c0re's admin socket and hive-agent's in-agent socket (mode 0666) read
the request with an unbounded read_line: no length cap and no deadline, so
a peer that never sends a newline grows a buffer and pins a task forever.

The bounded reader (16 MiB cap) moves from hive-c0re's socket_server into
hive-sock-client, the one crate both daemons already share or can take, and
gains optional deadlines for the first byte and for the rest of the line.
Both sockets now use it and answer an over-long or stalled line with the
same error reply the bounded sockets give, then close. The admin socket
bounds only the started line (clients may idle between requests); the
in-agent socket is single-shot and bounds silence too. The per-agent
sockets keep their behaviour (no deadline).
This commit is contained in:
atlas 2026-10-16 11:36:14 +02:00 • committed by mara
commit 1f214f9f01
10 changed files with 425 additions and 87 deletions

View file

@ -1,7 +1,8 @@
# hive-sock-client
One JSON-line-over-unix-socket client, shared by every daemon that speaks
to a hyperhive socket.
to a hyperhive socket, plus the bounded request-line reader the socket
servers share.
The wire protocol is the same everywhere: connect, write one line of JSON,
read one line of JSON back. Before this crate existed, five daemons each
@ -23,6 +24,15 @@ in-agent socket both use it, with their own wire-type crates.
on. The drain is not optional: without it the server's write-back lands
on a closed socket.
## Server side
`read_request_line` is the one bounded reader for the request line a
socket server accepts: at most `REQUEST_LINE_MAX_BYTES`, with optional
`LineDeadlines` (wait for the first byte, wait for the newline). A server
answers `RequestLine::refusal()` and closes. `hive-c0re` uses it on the
host admin socket and the per-agent sockets; `hive-agent` on
the in-agent socket.
## Retry is a policy value, not a fork
`Retry::RideOutRestart` backs off 2/4/8/16/30s (60s total), sized to ride