Skip to content

fix: release idle upstream conns on egress Close; skip unreadable subdirs in fs.find - #124

Merged
CMGS merged 3 commits into
mainfrom
batch0/egress-idle-conns-and-find-skip
Sep 2, 2026
Merged

fix: release idle upstream conns on egress Close; skip unreadable subdirs in fs.find#124
CMGS merged 3 commits into
mainfrom
batch0/egress-idle-conns-and-find-skip

Conversation

@CMGS

@CMGS CMGS commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

sandboxd/egress

Proxy builds two http.Transports per sandbox (tr, mitmTr) with IdleConnTimeout unset and Close only closed the hijacked tunnels, never the transports' idle pool. Upstream keep-alive connections (and their readLoop goroutines, which pin the transport) outlived the released claim; nothing in the module called CloseIdleConnections. Close now drops the idle pool on both transports, and both expire idle connections after 90 s.

  • TestCloseReleasesIdleUpstreamConns: one proxied GET, then Close; the upstream's ConnState must observe StateClosed. With the CloseIdleConnections calls removed the test reports upstream connection still open after Close.

silkd/src/find.rs

fs.find treated a read_dir failure on a queued subdirectory as fatal (err_frame mid-stream, after matches had already shipped) while scan_file deliberately skips unreadable files. An agent grepping a tree that a build is mutating lost the whole search. The root directory stays fatal (a bad path is a request error); a queued subdirectory that cannot be opened, or whose iteration fails, is skipped.

Gates

GOWORK=off make go-lint: 0 issues ×10 (5 modules × linux/darwin). asl ./... in sandboxd both GOOS: clean. make lint + make test (boot/init + silkd, fmt/clippy/test): green. make go-test: green.

CMGS added 3 commits September 2, 2026 15:25
…dirs in fs.find

egress: each sandbox's Proxy owned two http.Transports with no idle
timeout, and Close never closed their idle pool, so a released claim
left its upstream keep-alive connections and their read loops behind.
Close now drops the idle pool and both transports expire idle
connections after 90 s.

silkd: fs.find returned a terminal error frame when read_dir failed on
a subdirectory it had already queued, while an unreadable file was
skipped; a tree changing under a running find (a build removing a
directory) lost the whole search mid-stream. Only the root directory
is fatal now; a queued subdirectory that cannot be opened is skipped.
…le in the fake

A read_dir error on the requested root after partial enumeration was
folded into the subdirectory skip and answered done with a truncated
result; the root stays fatal, only queued subdirectories are skipped.
The Go silkdtest fake now applies the same rule so the SDK tests see
what silkd does.
…M transport cloned

The nested-loop rewrite hid the success return three levels deep; the
original while-let carries the root-fatal / subdirectory-skip split as
two match guards. The directory stack held re-encoded Strings while
ent.path() already owned a PathBuf. The fake's SkipDir branch could not
differ from nil: WalkDir revisits a directory only after its ReadDir
failed. The MITM transport re-spelled the base transport's fields.
@CMGS
CMGS merged commit 4604b69 into main Sep 2, 2026
2 checks passed
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