Skip to content

Release synchronized npm packages at 0.2.5 - #109

Merged
JacobLinCool merged 12 commits into
mainfrom
a-release-0.2.5
Oct 16, 2026
Merged

JacobLinCool merged 12 commits into
mainfrom
a-release-0.2.5

Conversation

@JacobLinCool

@JacobLinCool JacobLinCool commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Release the seven synchronized WASM-OJ code packages at 0.2.5 after merging the browser Worker teardown and metering safepoint fixes. Update exact workspace dependencies, the CLI version and action default, lockfile, and release notes. Toolchain package versions and Contract 2 remain unchanged.

Release notes explicitly describe the empirical 250 ms teardown workaround, its latency cost, and refreshed runtime/cost-profile identity without promising a fixed termination latency.

Validation: library:build, library:verify (including a clean NodeNext consumer), ci:verify, and exact code-version verification passed with Node 24.18.0 and pnpm 10.34.5. The final main-merge resolution has the identical Git tree as the release revision that already passed CI.

Underlying runtime verification: Rust regression tests, 36 old/new metering comparisons, 7 native judge integration tests, and 35 targeted checks each in Chromium, Firefox, and WebKit passed.

TakalaWang and others added 12 commits October 9, 2026 16:55
…iling with EPIPE

Closes #101. When one side of an interact session exited or closed its stdin, its peer's next write failed with EPIPE on both hosts. A CPython interactor that replied to a contestant that had already exited died with BrokenPipeError and exit 120, and because the stdout wrapper records into the transcript before writing to the pipe, each retried flush added the reply again (five copies). Judges that run both programs natively keep draining each program's output until it exits, so the interactor reads EOF and exits with its own verdict.

InteractiveOutput (server) and StreamOutput (browser side Workers) now treat a broken pipe as a successful write: the bytes are already in the transcript and are dropped. Reads from a side that has exited still return the remaining buffered bytes and then EOF. The transcript records each byte a side writes exactly once, up to its output limit, including bytes written after the peer exited, so it depends only on what the writer wrote.

Tests cover both hosts: runtime-core unit tests for writes after either side exits and EOF after buffered bytes, server integration tests with C and CPython interactors exiting 42/43 after replying to an exited contestant, and strict-CSP browser fixtures for the same cases plus the reply-before-EOF race. runtime-core_bg.wasm is rebuilt and the runtime identity pins refreshed, which changes cost profiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…timizes them

In WebKit an empty C++ for(;;); took about 25 s to reach the default instruction budget (Chromium 1.3 s, Firefox 2.9 s), so it usually hit the wall limit first and was reported as a wall-time TLE.

The meter is not optimized away; the trap does arrive, just late. JavaScriptCore (Safari 26, also the macOS 26.6 jsc shell) never enters optimized code inside a loop of a function that has no parameters and no locals. With --verboseOSR the baseline tier logs "Consider OSREntryPlan" about once per iteration (18 million times in 2e8 cost units) although the OMG entry code exists, so every iteration takes the tier-up slow path: about 14 times slower than BBQ alone (--useOMGJIT=false) and 100 times slower than the same loop in a function with one unused local. The forge meter makes no difference; any loop body behaves the same way.

The final instrumentation pass (MeterInitializer, which already re-encodes the module to set the budget) now gives every function that contains a loop but has no parameters or locals one unused i32 local. It changes neither behaviour nor cost. WebKit now stops the empty loop at the budget in about 0.2 s; Chromium and Firefox are unchanged.

A unit test covers which functions receive the local, and the strict-CSP suite gains empty-loop fixtures for run and interact that must reach instruction-limit before a 15 s wall limit. runtime-core_bg.wasm is rebuilt and the runtime identity pins refreshed, which changes cost profiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A browser Worker killed without an error event (the browser terminating it, or terminate() from outside) went unnoticed: interact and run waited for the wall limit and reported wall-time-limit, blaming the student's program, and a killed compiler or stage Worker waited for its build or stage timeout.

Every forge Worker starts from createModuleWorker's blob bootstrap, which now takes a uniquely named Web Lock for the Worker's lifetime as it starts and reports the lock's name to the parent. The parent requests the same lock; it is granted only once the Worker's context is destroyed. If that happens before the owner called terminate() (which createModuleWorker wraps to cancel the watch), onModuleWorkerLost listeners run. BrowserRunner, BrowserCompiler, the interactive side Workers and the compiler stage Workers feed them into their existing crash paths, so the engine reports runner-failure or compiler-failure. Listeners are called directly because WebKit drops events dispatched on a Worker after terminate(). Without Web Locks nothing changes.

Interactive pipe waits now use 100 ms Atomics.wait slices. WebKit never stops a terminated Worker blocked in an untimed Atomics.wait, so a killed side Worker was undetectable there.

The strict-CSP suite gains a liveness section that kills side, runner, compiler and rustc stage Workers mid-operation in each browser and checks prompt rejection and recovery, plus a no-false-positive run of 20 runs, 5 interactive sessions and a build. Detection: Firefox immediately, Chromium within about 2 s for busy Workers (its forced-termination delay), WebKit within about 80 ms except for a Worker spinning in pure Wasm, which WebKit does not stop until it returns to JavaScript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…led Workers

JavaScriptCore acts on Worker.terminate() only at JavaScript checkpoints,
never inside Wasm, so a terminated runner or interactive side kept
computing until its instruction budget ran out and Web Lock liveness
could not see the kill.

The charge that opens each function and loop body is now inlined and
compared with a threshold. Every 2^20 units a cold function calls the
imported wasm_oj_metering.safepoint, which is a no-op natively and an
Atomics.wait that returns at once in browsers. Loops reach it through
a branch out of the loop, because a call inside a hot loop slowed the
whole loop in JavaScriptCore and V8. Costs and the exhaustion point are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… growth

JavaScriptCore crashes the page (SIGSEGV in SharedArrayBufferContents::grow)
when a shared WebAssembly.Memory grows while a Worker whose instance
imported it is being torn down. The Wasmer SDK terminates a thread Worker
whenever a WASIX thread or process ends and grows its shared memory when
the next one starts, so full WebKit runs lost the page about two times in
three.

OwnedWorkerRegistry now owns only the SDK's thread Workers, holds their
terminate() calls until the running operation ends, and starts the next
operation only after 250 ms without a termination. The compiler, the
rustc stage and the runner wrap their operations in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobLinCool
JacobLinCool merged commit 64fd6c5 into main Oct 16, 2026
1 check passed
@JacobLinCool
JacobLinCool deleted the a-release-0.2.5 branch October 16, 2026 16:28
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.

2 participants