Repository navigation
fix(runtime): enforce Node heap limits - #145
Conversation
1f2be7b to
07a6542
Compare
b02d43a to
3365426
Compare
Adapts oven-sh#38008 to borrowed process descriptors and waits for pending writes before the next isolated file can register its stdio polls. Covers serial, parallel, and backpressured output without closing fd 1 or 2. Install the existing python3-fuse test prerequisite in native Linux CI. macOS: 395 passed across isolation, process and FileSink suites; small-output Linux regression and FUSE cases passed; backpressure negative control loses output on the prior implementation. P2 scoped-clean.
|
Readiness remains held at The earlier A narrow test-only correction is prepared: reject an undefined The complete native test file has not yet run with that correction. It must pass through the repository's CI runner, followed by exact-head CI after publication, before this hold is cleared. No fork merge or release is requested by this update. |
Prepare the 2000-module, 64-function input corpus once for the exit-mode group. Each mode still gets a fresh empty compile-cache directory, its original 30-second case limit, all integrity and warm-read checks, and the existing strict signal-exit assertions. The Windows two-case matrix retains 16028 assertions and drops from 34-37 seconds to 25 seconds by avoiding duplicate fixture work. The full Windows module suite passes 205 tests with existing skips/todo; P2 review is scoped-clean.
Restrict graceful stdio flushing to isolation disposal, which has an I/O drain barrier. VM teardown now uses the native close path to release pending polls and keep-alive references before destroying the VM. Exercise real VM destruction with backpressured stdout and stderr. Internal observers assert native cleanup before the child exits, while the existing file-swap regression preserves all buffered output.
Keep the 100 ms wall-clock minimum and additionally require 100 ms of process CPU time for sample-dependent workloads. A descheduled process can otherwise consume the entire fixture window without executing the profiled work. Preserve every profile assertion, sampling interval, concurrency setting, and test deadline.
Keep the outer shell from reassigning the terminal after Bun has already handed it to the script. A pipe gates child exec on the initial foreground assignment, and READY waits for the script to become foreground. Read complete marker lines before parsing process groups. Preserve the stop/continue assertions, concurrency, and existing hang guards.
|
Replying to the teardown finding: confirmed and fixed in 4af0caf4d49. The entire graceful The regression uses the actual process stdout/stderr sink and leaves the parent's data pipe unread until exit. It verifies native EAGAIN, pending data, a poll and a keep-alive before exit. An observer in the real VM stop sweep checks Linux affected proof passed 828 tests with six existing skips. macOS passed 843 tests across the affected suites plus the profiler file, with six existing skips and one todo. All 12 Rust cross-check targets passed, and the correction has a scoped-clean P2 review. The exact runtime build also passed OpenClaw Current head is |
What changes
bun --max-old-space-size=32previously completed a workload retaining 256 MiB. This connects the CLI andNODE_OPTIONSflag to the fork’s per-VM managed-heap limits. CLI values override the environment; zero restores defaults. Workers inherit the process limit, retainERR_WORKER_OUT_OF_MEMORYand exit 1 on exhaustion, and main-VM exhaustion remains fatal. ArrayBuffer backing stores are excluded.process.allowedNodeEnvironmentFlagsadvertises the flag.Related upstream work: oven-sh/bun#34917 and oven-sh/bun#34924. The branch is based on
bf099fbbc4a, including the resolver/Mordant, TLS and subprocess fixes. The WebKit dependency is unchanged.CI repairs
Linux’s piped
systemd-coredumpcollector ignored a zero core-size limit. A controlled abort with both core limits zero streamed at least 2 GiB; clearing the child’scoredump_filterreduced it to 49 KiB with the same SIGABRT. The test helper applies both settings only to intentionally fatal children and their descendants. Original heap budgets, signals and assertions are preserved. Linux CI subsequently completed with about 79 GB free and 414 KB in its core store. Its FUSE prerequisite now matches the test images.The stdio repair adapts oven-sh/bun#38008 to borrowed fd 1/2. Isolation swaps drain pending writes before replacing the global. The VM-teardown finding is corrected in
4af0caf4d49: onlyDisposeduses graceful flushing;VmTeardownuses native close to release its poll and keep-alive before destroying the VM. An actual-sink backpressure regression fails on the instrumented pre-fix branch and passes on Linux and macOS, asserting native cleanup and a clean exit. The existing 8 MiB swap regression preserves every byte.The remaining test repairs preserve their contracts: the CJS snapshot includes the existing
module.exportsmarker; compile-cache exit cases share an immutable 2,000-module input corpus while keeping fresh output caches and all original assertions and deadlines. Sample-dependent CPU-profile fixtures require actual CPU work alongside their existing wall-time minimum. The PTY fixture gates child exec on its initial foreground assignment and waits for the script’s foreground handoff before Ctrl-Z. A forced late-parent control reproduced its former invalid foreground state and false stop/resume failure. Concurrency, sampling intervals, heap limits and test deadlines are unchanged.Validation
Head:
20ae7f644276950d95090bb2958e54c2afbe00b9. READY for coordinator review and merge.publish=false.4af0caf4d49.agents-supportatb3196dfda33555857eae9cd52ea29367a91bd9ea: 5,193 passed, 30 skipped, three pending, zero failures across its 390-file selection, using the exact runtime build withNODE_OPTIONS=--max-old-space-size=8192and private HOME/state/temp roots.An earlier Linux
unit-fastrun retained one provider-catalog retention failure, also seen on a byte-identical test before this PR on Bun mainb3684189fe1f. Its cause remains unresolved; no retention fix or passing retry is claimed. The successfulagents-supportrun supplies the requested consumer check.The PR remains open and unmerged. No release, shared pin or owner admission has changed.