Repository navigation
T132 — A refused name always reaches the log, and one box cannot hold the proxy's owner lookups - #2997
Conversation
The REFUSED warning for a name outside allow_dns_hosts was keyed by one of 256 hash buckets, so names in one bucket shared one line a minute. Each box now logs each refused name once a minute, up to 256 names, and one line counts the refusals past that bound.
Concurrent connections from the node's address now wait on one shared owner walk, run at most once a second, instead of a walk each on four slots. At most 64 connections wait. One more is refused as a caller the proxy cannot name, and the refusal line counts the waiting connections. The one-name-at-a-time lookup still runs per connection inside the walk, until the socket lookup can name a batch in one pass.
…name-always-reaches-the-log-and-one-bo
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
NET-141 and NET-070 conform to the design. The proxy still refuses every caller it cannot name, as §7.1 line 254 requires. One gap is open. In production, the shared walk still calls connecting_box once for each connection, so a burst costs one /proc pass for each connection. The starvation test passes only through the test-only with_socket_owners hook. No issue owns the batch lookup in dns.rs. Make the change in C1: file that issue, name it in the PR body and the code, and make the test's doc comment say what it proves.
Ruled at 71d5b24 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
A connection that timed out or went away left its entry in the shared owner walk's queue. The entry held a place under the cap of 64, and the next walk still looked it up. The queue now drops closed entries before the cap check and when a walk takes its batch.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 4 unresolved threads — minimal-foundry[bot] crates/minimald/src/net/proxy.rs:365, minimal-foundry[bot] crates/minimald/src/net/proxy.rs:382, minimal-arch[bot] crates/minimald/src/net/proxy.rs:240, minimal-arch[bot] crates/minimald/src/net/proxy.rs:4864. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The refusal log and the shared owner walk conform to §5.3 and §7.1, and every path with no answer fails closed. In production the walk still does one /proc pass for each connection, because Router::new uses OwnerSource::One(connecting_box). The PR body states this gap, but no issue owns it, and the PR closes #2943. Section 9 line 331 requires that one box cannot exhaust shared state. Open the batch-lookup issue and name it in the PR body as a residual (C1). Then the change conforms.
Ruled at cde5eac against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
A box that asks for many refused names sees each one in the daemon log. A host-address box that opens up to 63 connections at once does not get another box's proxied request refused, and connections that go away no longer hold places in the owner-lookup queue. Notes from the agent: Revise round 1. The shared owner walk now drops entries whose connection stopped waiting, both before the cap check and when a walk takes its batch. A new test pins this. The doc comment on OWNER_LOOKUP_WAITING now states the limit of the cap: the proxy cannot tell which box opened a connection before the walk names it, so a burst that fills all 64 places refuses another box's connection until the next walk takes the batch. That cap and its refusal are what the task specifies. clippy -p minimald --all-targets and cargo fmt --check are clean. just clippy-strict was not run. |
|
/revise |
…name-always-reaches-the-log-and-one-bo
Add dns::connecting_boxes, which reads the socket tables once and walks /proc/*/fd once for every waiting connection. Router::new uses it, so the shared owner walk no longer does one /proc pass per connection. The burst test now drives this production lookup.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 5 unresolved threads — minimal-foundry[bot] crates/minimald/src/net/proxy.rs:369, minimal-foundry[bot] crates/minimald/src/net/proxy.rs:386, minimal-arch[bot] crates/minimald/src/net/proxy.rs:240, minimal-arch[bot] crates/minimald/src/net/proxy.rs, minimal-arch[bot] crates/minimald/src/net/proxy.rs:580. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head resolves the open item from the ruling on cde5eaca. dns::connecting_boxes reads the socket tables once and walks /proc once for all waiting connections, and Router::new uses it. Each failure path gives Unknown, as connecting_box does, and the proxy refuses Unknown (design §7.1 line 254). This head does the work of issue #3000. Close that issue, and update the Proof and Notes in the PR body, because they describe the earlier head.
Ruled at eadad7a against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
|
Round 2 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
A box that asks for many refused names sees each one in the daemon log. A host-address box that opens many connections at once does not get another box's proxied requests refused, because production now names every waiting connection's owner from one read of the socket tables and one walk of /proc/*/fd. Notes from the agent: This round adds dns::connecting_boxes, the batch SocketOwners function. Router::new sets owners: Some(connecting_boxes), so production uses OwnerSource::Batch. with_socket_owner (the one-pair test hook) now clears owners, so owners_one_by_one runs only in those tests. burst_of_connections_does_not_starve_other_boxes_lookups now uses Router::new with 64 real loopback connections. The test process is in no box's leaf, so each one is named 'no box'. The test asserts that all 64 are answered inside OWNER_LOOKUP_WAIT in 3 walks or fewer. The earlier slow two-box test is kept as burst_from_one_box_does_not_starve_another_box_with_a_slow_walk. A new dns test, connecting_boxes_names_each_pair_as_connecting_box_does, checks that the batch gives the same answers as connecting_box. OwnerWalk counts its walks, and the debug line logs the count. Each holder pid gets its cgroup r 10000 ead and one more fd-directory read, once per holder and not once per pair, to keep connecting_box's pid-reuse check. The directive asks to remove the Residuals heading from the PR body and to add 'Closes #3000' beside 'Closes #2943'. I cannot edit the PR body, and my instructions forbid closing keywords in commits, so the runner must make that body change. The batch lookup that #3000 asks for is now in this PR. Also ran cargo nextest run -p minimald net::proxy net::dns:: (110 passed) and clippy -p minimald --all-targets (clean). |
There was a problem hiding this comment.
Reviewed eadad7ab against T132's plan block. Refused names are logged per name up to a bound, with the rest counted. Owner lookups share one walk in production through dns::connecting_boxes, and an unknown owner fails closed. Past 64 waiting lookups a connection is refused as unattributed: the task specifies that cap, and the doc comment states it, so a burst that size can still refuse another box. Arch-review passes on this head.
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of eadad7abe697 withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.
T132 — A refused name always reaches the log, and one box cannot hold the proxy's owner lookups
slice: S16
kind: task
covers: NET-141, NET-070
size: M
est: 110 code, 140 tests
executor: agent
difficulty: needs care
model: standard
diagnostics:
min bugbundles carry the daemon log, where every refused name a box asked for appears within its window, and a proxied request refused for want of an owner lookup records how many connections were waitingobservability: the relay's refusal line is rate-limited per name with one line per window counting names past the per-box bound; the proxy logs at debug each shared
/procwalk with the connections it answeredlayers:
- dns:
- crates/minimald/src/net/dns_gate.rs:
unmatched_refused_keyrate-limits the refusal line per name instead of per hash bucket, with a bound of 256 distinct names per box per window and one line counting the names past ittest: cargo nextest run -p minimald refused_names_sharing_a_bucket_each_logged
- proxy:
- crates/minimald/src/net/proxy.rs:
Router::caller_foranswers concurrent owner lookups from one shared/procwalk, refreshed at most once a second, instead of a walk per connection, and caps the connections waiting on it at 64, refusing past the cap with the existing unattributed refusal, so a burst from one box cannot starve another box's lookupstest: cargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookups
produces: none
consumes: none
depends on:
- blocked by #2932
proof: A box that asks for many refused names sees each one in the daemon log, and a host-address box opening many connections at once does not get another box's proxied requests refused.
Proof
A box that asks for many refused names now sees each name once a minute in the daemon log, up to 256 names per box per minute. One warn line counts the refusals past that bound. Concurrent proxied connections from the node's address now share one owner walk, at most once a second, with at most 64 connections waiting. In the test with a slow batch lookup, a burst of 63 connections from one host-address box does not delay the lookup for a second box's connection past the wait bound. In production, each connection is still looked up one at a time inside the shared walk, so the proof holds in full only when a batch lookup exists (see notes).
Notes from the agent: 1) dns_gate.rs:
unmatched_refused_keyand its 256 hash buckets are removed. They are replaced by a per-boxRefusedNameswindow: each name is logged once a minute, up to 256 names, and one warn line counts the refusals past the bound. That line is written when the next window starts or when the box's gate is dropped. This line does not use the shared PolicyWarnLimiter, because that limiter nev 8000 er evicts keys. The old bucket testunmatched_name_refusal_keys_stay_boundedis replaced byrefused_names_past_the_bound_are_counted_once_a_window. 2) proxy.rs, partial: the layer asks for one shared /proc walk. The batching, the 1 s pacing, the 64 cap and the debug line for each walk are in proxy.rs. But crates/minimald/src/net/dns.rs (outside this task's layers) has only a per-connection lookup,connecting_box, and its helpers are private. So in production a shared walk still callsconnecting_boxonce per waiting connection, on at most 4 threads, the same parallelism as before. A walk of 64 connections therefore costs 64 /proc passes. To get one real /proc pass, a follow-up task must add a batch lookup in dns.rs (read the socket tables once, walk /proc/*/fd once for the set of inodes). It can then plug intoSocketOwners(todayRouter::with_socket_ownersis a test-only hook). The test uses such…[truncated]Tests
cargo nextest run -p minimald refused_names_sharing_a_bucket_each_loggedcargo nextest run -p minimald burst_of_connections_does_not_starve_other_boxes_lookupsVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Closes #2943
The batch owner lookup is in this PR:
Router::newusesdns::connecting_boxes, so a walk makes one/procpass. Any wording above that says otherwise describescde5eaca. PastOWNER_LOOKUP_WAITING(64 waiting lookups), a connection is refused as unattributed, as the task specifies.Closes #3000