Repository navigation
Description
Parent: #502
Related: #480, #985
Executed baseline
On exact main at b4f5544d61036e296ebd0046579d0b991b509025, the focused coordinator witness
zig test src/runtime_threads.zig -lc --test-filter 'host internal work uses one reservation and queues excess background work'passes and proves the existing schema-v7 boundary correctly admits one host-reserved compiler plus one general-slot compiler while queueing the third. RuntimeInternalWorkSnapshot records CPU requests, admissions, waiters, and wait time, but neither the coordinator nor the native/Wasm compiler entry points account or bound their temporary allocator bytes. GC auxiliary scratch is measured per Context by the opt-in runtime profiler, but it likewise has no process-wide admission policy. Concurrent contexts/hosts can therefore obey the CPU-slot contract while independently growing GC/JIT/Wasm scratch.
This is a resource-policy gap, not a leak or current correctness failure. Defaults must preserve existing unlimited behavior.
Required change
- Add one process-wide, fail-closed byte-admission contract for temporary GC auxiliary, native-compilation, and Wasm-compilation storage.
- Keep long-lived precise-heap cells, decoded Wasm modules, and published executable mappings/metadata in their existing ownership domains; they are not compiler scratch.
- Preserve synchronous JIT/Wasm compilation, exact claim/invalidation/publication semantics, GC abort/rollback behavior, and existing CPU-slot priority/FIFO ordering.
- A finite host/embedder limit may reject temporary growth as OOM, but a transient JIT scratch rejection must leave the tier retryable rather than caching semantic unsupportedness.
- Publish coherent schema-versioned current/peak/requested/rejected/released bytes and waiter/admission counters by domain plus a reconciled process total.
- Defaults remain unlimited; no benchmark/source recognition, hidden reserve, spin/sleep admission loop, or allocation moved outside the measured boundary.
Definition of done
- Deterministic allocator tests cover exact alloc/resize/remap/free accounting, per-domain and total caps, overflow-safe rejection, release/re-admission, nested work, OOM rollback, and teardown-zero balance.
- GC auxiliary storage uses the shared byte contract without entering the public Context heap limit or changing collector safety.
- Baseline and optimizing JIT temporary analysis/lowering storage use the contract; executable mappings and adopted metadata remain separately owned.
- Wasm decode/validation temporary storage is bounded without misclassifying the retained decoded module.
- Coherent telemetry invariants hold under concurrent readers/writers and unsuppressed TSan.
- Focused GC/JIT/Wasm/no-GIL gates and
zig build test-parallelpass. The broader threadfuzz lifecycle profile has the same four failures on the exact parent and candidate and is tracked separately in threadfuzz: property waitAsync notify loses ready waiter #1028. - Exact-parent dedicated and oversubscribed evidence records unchanged checksums plus RSS/latency/throughput and the new byte gauges before any performance claim.
- Parent issues Runtime: coordinate GC, JIT, Wasm, and worker CPU budgets #502 and Memory: bound heap, cache, and executable-code footprint #480 are updated with landed commits and evidence.
Activity
feat(runtime): bound process scratch memory (#1027)
glennmichael123 commentedon Oct 6, 2026
Landed the first slice in b4d773c (feat(runtime): bound process scratch memory).
The implemented contract is deliberately fail-closed at allocator admission rather than waiter-based: allocation-time parking can deadlock when the releasing owner depends on the blocked runtime path. The telemetry therefore records admission/rejection and release/re-admission, not scratch waiters.
What is now on main:
Verification:
Next slice: route temporary baseline/optimizing JIT analysis and lowering allocations through native_compilation, while keeping executable code and adopted metadata under their existing long-lived owners. Transient scratch OOM will remain retryable rather than publishing a permanent tier rejection.
feat(jit): account temporary compilation memory (#1027)
glennmichael123 commentedon Oct 6, 2026
Landed the native-compilation slice in bfd6700 (
feat(jit): account temporary compilation memory).Implementation:
native_compilationscratch domain;Focused evidence on the final tree:
zig build -j1: passThis completes the JIT checklist item. #1027 stays open for its separate Wasm temporary-storage integration and remaining aggregate gates/evidence.
feat(wasm): account temporary compilation memory (#1027)
glennmichael123 commentedon Oct 6, 2026
Landed the WebAssembly slice in 3b55e73 (
feat(wasm): account temporary compilation memory).Ownership boundary:
WebAssembly.Modulecontinues to decode retained module IR into the Context/store allocator; published operand/label depth arrays remain in that module arena.wasm_compilationscratch allocator for retained modules.WebAssembly.validateroutes both its decoded module and validation work throughwasm_compilation, because that module is destroyed before the call returns.WebAssembly.validatenow participates in the existing synchronous Wasm internal-work admission scope; public validity and compile-error behavior remain unchanged.The focused denial/retry test sets the Wasm domain cap to zero and proves exactly two policy rejections (retained-module validation and validate-only decoding), zero live-byte drift, restoration/retry, successful instantiation, and a retained module whose lifetime does not remain charged as scratch.
Final-tree evidence:
names.wast: 483 pass, 0 fail, 0 skip, 0 crashThis completes the Wasm decode/validation checklist item. #1027 remains open for the aggregate GC/JIT/Wasm/no-GIL/lifecycle gates, exact-parent resource/performance evidence, and parent issue updates.
bench(runtime): pair compiler scratch evidence (#1027)
fix(bench): parse hardware metadata deterministically (#1027)
fix(bench): reject underwarmed scratch evidence (#1027)
docs(bench): publish compiler scratch evidence (#1027)
glennmichael123 commentedon Oct 7, 2026
Final evidence is now on main in four additional commits:
f149135f— paired schema-7 parent/schema-8 candidate compiler-pressure harness with cold, warm, and teardown phases;7b1ba792— deterministic hardware metadata parsing in the Home runtime;24d7ff72— four-process warmup floor and fail-closed RSD interpretation;d55b4456— 216 raw phase rows, dated report, methodology link, and checked docs manifest.Published evidence:
The exact-parent run compares
b4f5544d61036e296ebd0046579d0b991b509025with24d7ff72fad07fc37512fea6c09b7cca9bb9c325using the same overlaid runner, workload checksum, Zig, zig-gc, and zig-regex revisions. It records nine fresh-process pairs after four discarded warmup processes at one lane and at 20 lanes (2× the 10-core host).Accounting/lifecycle results:
Two dedicated timing series exceed 10% RSD (maximum 28.92%), so the report keeps every sample and explicitly makes no speed claim from those rows. The busy JIT-on series remains bounded, but this issue's acceptance evidence is resource accounting, lifecycle, checksums, and absence of a material RSS increase—not a throughput claim.
Completed final-tree gates so far:
The lifecycle threadfuzz profile exposed a separate pre-existing property-backed
waitAsyncnotification failure. Exact parent and current main both produce the same four failures from the same 224 programs/seeds; it is tracked without suppression in #1028.zig build test-parallel -Dunit-jobs=1 -j1is currently running from a clean archive snapshot against the real collector. #1027 remains open until that terminal result is recorded and parent issues #502/#480 are updated.test(runtime): complete scratch accounting coverage (#1027)
glennmichael123 commentedon Oct 7, 2026
#1027 is fully implemented and verified on
main.Implementation and evidence commits:
b4d773c2— shared fail-closed byte admission and schema-v8 telemetrybfd6700a— JIT temporary compilation accounting and retryable denial3b55e737— Wasm temporary decode/validation accountingf149135f,7b1ba792,24d7ff72,d55b4456— paired exact-parent benchmark and published evidence8794ccc5— complete deterministic allocator accounting coverageFinal verification:
zig build test-parallel -Dunit-jobs=4 -j1: 2,567 passed, 1 skipped, 0 failed, 0 leaked in 893.7sExact-parent evidence: report · raw JSON
The generic threadfuzz lifecycle profile reports the same four
property notify woke wrong count pn0failures across 224 programs on both exact parent and candidate. This is not a #1027 regression and is tracked in #1028; no suppression or workaround was added.Parent updates are posted on #502 and #480. Closing this focused child while those broader umbrellas remain open.