Skip to content

fix(browser): cover raw fs bridge globals and regenerate the wasi polyfill#197

Merged
NathanFlurry merged 2 commits into
mainfrom
stack/fix-browser-mark-raw-fs-bridge-globals-unsupported-in-the-browser-facade-yxplzzou
Jul 2, 2026
Merged

fix(browser): cover raw fs bridge globals and regenerate the wasi polyfill#197
NathanFlurry merged 2 commits into
mainfrom
stack/fix-browser-mark-raw-fs-bridge-globals-unsupported-in-the-browser-facade-yxplzzou

Conversation

@NathanFlurry

@NathanFlurry NathanFlurry commented Jul 2, 2026

Copy link
Copy Markdown
Member
  • _fsReadRaw/_fsWriteRaw/_fsWriteFileBinaryRaw were added to
    bridge-contract.json by the raw fs fast path without browser facade
    coverage, failing check:bridge-contract ever since.
  • Regenerate wasi-polyfill.ts from the shared native WASI runner (stale after
    the create-parent-aware path resolution fix landed in the runner).

Restores a green 'pnpm --dir packages/browser check-types'.

Closed guest loopback sockets never released their kernel socket-table slots
until process exit (measured: vm_sockets highWater 81 for a workload whose
true concurrency is ~9), so connection-churning guests hit EAGAIN 'maximum
socket count reached' at ~250 cumulative sockets.

- Bridge: natural FIN close finalization now releases the sidecar/kernel
  handle (idempotent, once), deferred until JS readable buffers drain so
  buffered data is never dropped.
- Sidecar: net.poll close handling closes the underlying TCP/Unix handle when
  removing map entries; explicit close paths funnel through an idempotent
  kernel close (ENOENT tolerated); the TLS-mode close path no longer skips
  kernel close for kernel-backed sockets.
- Guest fetch() now uses a bounded per-call undici dispatcher instead of the
  process singleton whose pooled clients went stale against released sockets
  and hung (also fixes a pre-existing hang: repeated fetch over a kept-alive
  loopback connection). Revisit pooling when host->guest socket event push
  (#178) lands.
- Regression test: guest churns 3x max_sockets connections with closes.

Full net family at 30 iterations passes (previously EAGAIN at tcp_concurrent_4):
fetch 2.59ms, tcp_echo 3.57ms, tcp_concurrent_4 4.91ms guest p50; leak probe
highWater 81 -> 17 with depth returning to 0.
@NathanFlurry

NathanFlurry commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Stack for rivet-dev/secure-exec

Get stack: forklift get 197
Push local edits: forklift submit
Merge when ready: forklift merge 197

@railway-app
railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-197 July 2, 2026 10:02 Destroyed
…yfill

- _fsReadRaw/_fsWriteRaw/_fsWriteFileBinaryRaw were added to
  bridge-contract.json by the raw fs fast path without browser facade
  coverage, failing check:bridge-contract ever since.
- Regenerate wasi-polyfill.ts from the shared native WASI runner (stale after
  the create-parent-aware path resolution fix landed in the runner).

Restores a green 'pnpm --dir packages/browser check-types'.
@NathanFlurry NathanFlurry changed the title fix(browser): mark raw fs bridge globals unsupported in the browser facade fix(browser): cover raw fs bridge globals and regenerate the wasi polyfill Jul 2, 2026
@NathanFlurry
NathanFlurry force-pushed the stack/fix-browser-mark-raw-fs-bridge-globals-unsupported-in-the-browser-facade-yxplzzou branch from 9fd33a7 to 20130d2 Compare July 2, 2026 10:02
@railway-app
railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-197 July 2, 2026 10:03 Destroyed
@NathanFlurry
NathanFlurry changed the base branch from stack/fix-sidecar-release-kernel-socket-slots-when-guest-sockets-close-pympklxu to main July 2, 2026 10:03
@NathanFlurry
NathanFlurry merged commit 20130d2 into main Jul 2, 2026
1 check was pending
@NathanFlurry
NathanFlurry deleted the stack/fix-browser-mark-raw-fs-bridge-globals-unsupported-in-the-browser-facade-yxplzzou branch July 2, 2026 10:03
@railway-app
railway-app Bot temporarily deployed to secure-exec / preview July 2, 2026 10:03 Inactive
@railway-app
railway-app Bot temporarily deployed to secure-exec / production July 2, 2026 10:03 Inactive
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