Repository navigation
fix(v8-runtime): stop guest JavaScript whose WebAssembly memory passes the heap limit - #2080
Merged
eersnington merged 1 commit intoOct 27, 2026
Conversation
Contributor
📟 Pip-Boy ·
|
| package (linux-x64-gnu) | @latest |
base | this PR | Δ vs base | packages |
|---|---|---|---|---|---|
@rivet-dev/agentos-core |
326.0 MB | 326.0 MB | 326.0 MB | 0 | 10 (0) |
@rivet-dev/agentos-node-pty |
7.6 KB | 18.0 KB | 18.0 KB | 0 | 1 (0) |
@rivet-dev/agentos-posix |
253.8 MB | 253.8 MB | 253.8 MB | 0 | 7 (0) |
@rivet-dev/agentos-runtime-core |
253.8 MB | 253.8 MB | 253.8 MB | 0 | 6 (0) |
@rivet-dev/agentos-sandbox |
363.7 MB | 363.7 MB | 363.7 MB | 0 | 85 (0) |
@rivet-dev/agentos-toolchain |
130.8 KB | 141.2 KB | 141.2 KB | 0 | 2 (0) |
🧹 Rust dependencies · cargo deny + cargo shear
| check | new in this PR | fixed | existing on base |
|---|---|---|---|
| advisories | ✅ 0 | 0 | 28 |
| licenses | ✅ 0 | 0 | 0 |
| sources | ✅ 0 | 0 | 0 |
| bans | ✅ 0 | 0 | 0 |
| unused | ✅ 0 | 0 | 16 |
🦀 Binaries · publish Dockerfiles, --release
Base: main@ae5e5cd, the newest main commit with native builds before the merge base. Size changes merged to main since then show up here too.
| artifact | npm @latest |
base | this PR | Δ vs base |
|---|---|---|---|---|
agentos-native-sidecar linux-x64-gnu |
143.8 MB | 143.8 MB | 143.8 MB | +4.8 KB (+0.0%) |
⏱ Timing
| job | wall time | slowest step |
|---|---|---|
changes |
28s | checkout · 25s |
zizmor |
10s | Set up job · 2s |
footprint |
2m54s | Pack the base · 49s |
hygiene |
1m00s | checkout · 28s |
native · linux-x64-gnu |
10m11s | Build with the publish Dockerfile · 9m55s |
⏭ self-test |
— | skipped |
report |
22s | Write the comment and run summary · 6s |
🔭 Full CI trace for this commit
One OpenTelemetry trace of CI and Pip-Boy for b80c307: every job and step, with the sizes above attached. Run after CI finishes.
pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha b80c3076a3384e3d1f55d1f6d010b6641b9b4a49Add --otlp <url> to send it to any OTLP/HTTP collector.
Agent instruction: From a rivet-dev/agentos checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2078. Stacked on #2079.
#2079 caps
ArrayBuffermemory through V8's ArrayBuffer allocator. V8 allocates WebAssembly memory through its page allocator instead, so a guest could still hold gigabytes inWebAssembly.Memoryand OOM the shared sidecar. Host-provided buffers are also outside that budget on purpose.install_external_memory_guard(crates/v8-runtime/src/isolate.rs) adds a GC prologue check. When external memory outside theArrayBufferbudget passes the heap limit, it terminates the script and sets the existing heap-limit flag.execution_heap_limit_exceedederror, which nameslimits.jsRuntime.v8HeapLimitMb. The sidecar emits av8_external_memory_byteslimit warning.javascript_execution_limitsinnative-sidecarsetsJavascriptExecutionLimits::limit_external_memory, andRuntimeCommand::CreateSessioncarries it to the session. The session installs the guard when it first runs on an isolate, so warm-pool keys do not change.create_guest_isolatereplaces the two copies of isolate setup (fresh and snapshot) and keeps the budget on the isolate for the check.flowchart LR A[launch.rs: JS execution] -->|limit_external_memory: true| B[CreateSession] P[Python / WASM runner] -->|false| B B --> C[session thread] C -->|true| D[GC prologue check] D -->|external memory minus budget > limit| E[terminate: execution_heap_limit_exceeded]WebAssembly.Memory,grow, memory declared in a moduleexecution_heap_limit_exceededArrayBuffer, growableSharedArrayBufferSecurity
This is part 2 of 2 in a stack: