jspi: fix the dead-tools ownership bug, emscripten-6 fallout, and green the full suite on Playwright 1.62
Live-app fix (Place Footprints / routing dead in Chrome): submodule bumps carry the coroutine ownership fix (kicad 012d95ecb4) and the handler-exception survival fix (wxwidgets 1b5f0e31f4). Emscripten-6 fallout: - occ/ngspice worker wrappers: mainScriptUrlOrBlob was removed upstream; pthread children re-run the wrapper blob, so an em-pthread realm now importScripts the glue and gets out of the way (before: recursive service boots, pool never fills, silent 180s boot hangs — every occ spec and ngspice bg_run). - Makefile.wasm: -sASYNCIFY frankenlinks on the no-wx coroutine repro targets ported to -sJSPI (the JSPI-only libcontext crashed at first yield under them); mainloop/gl repro pages drive their tick through a promising export (emscripten_set_main_loop callbacks cannot suspend); retired inject-dyncall-shims lines removed (targets were unbuildable since Phase 8); $stringToNewUTF8 force-included (the EM_ASM value bridge aborted the runtime on the first decoded exception). - fiber-park levers: neither embind shape can drive suspending levers (plain throws on strict-JSPI Firefox; emscripten::async() re-executes its invoker on settle) — kept sync for manual Chromium probing, spec coverage moved to the jspi-coroutine harness (18 cases). Suite work: - Playwright 1.61.1 -> 1.62.1 (Firefox 153: JSPI on by default). - fiber-resume-park.spec retired -> coroutine-lifecycle.spec: census gate over boot / board load / chooser open / cancel (deterministically red on the pre-fix build). - Blind asyncify-era pins re-keyed: quasimodal-strand + wait-beacons beacon regexes, footprint-chooser-close liveness -> wx parking-timer heartbeat (scheduler counters idle flat on Firefox). - occ/ngspice test providers: 60s boot timeout + worker error surfacing (a worker death used to be a silent 180s timeout). - Harness pages: stale 9.99 config dir -> 10.0 (library_manager wxCHECK noise, chooser had no libraries). - gal-webgl harness: missing artifacts rebuilt (boost/glm extracted to the host sysroot), PgmOrNull stub added for the rebased GAL. - jspi-scheduler: clean-shutdown console line restored (app-quit contract), quarantine never yanks SP from a live window. Gates: test:e2e 699 passed / 0 failed (wx-chromium, kicad-firefox, kicad-chromium, jspi-firefox, coroutine-firefox); web ff/cr/mobile 71 passed; lint:ci-coverage 166, lint:determinism 163, screenshots manifest 492 current, corpus 7/7, tools:contract green. Offline screenshot baselines show expected mass drift from the engine bump — re-baseline (screenshots:noise -> promote) is a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016X9eh1s5sTx1o9Em9KBuwR
This commit is contained in:
parent
94cac5e4d4
commit
db819850ee
31 changed files with 577 additions and 359 deletions
|
|
@ -3,8 +3,10 @@
|
|||
// KiCad's GAL renders via WebGL 2.0 in the rAF refresh, and tool coroutines activate
|
||||
// during the same refresh — so the Asyncify unwind/rewind happens MID-RENDER-FRAME with
|
||||
// the GL context current. This probe creates a real WebGL-2.0 context and activates the
|
||||
// coroutine between GL draw calls inside an emscripten_set_main_loop(rAF) frame, then the
|
||||
// coroutine yields back -> main rewinds the render frame.
|
||||
// coroutine between GL draw calls inside the rAF-driven frame, then the coroutine
|
||||
// yields back and the frame's promising activation suspends/resumes. (JSPI 2026-08-13:
|
||||
// emscripten_set_main_loop callbacks are plain calls and cannot suspend — the frame is
|
||||
// driven like the shipped app drives ticks, a JS rAF loop over a promising export.)
|
||||
//
|
||||
// No-wx (single-threaded first; GL+pthreads needs OFFSCREEN proxying — add later if this
|
||||
// passes). Firefox should reach "[REPRO] DONE"; if system Chrome crashes before DONE, the
|
||||
|
|
@ -13,6 +15,7 @@
|
|||
#include "kicad_coroutine_harness.h"
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/em_js.h>
|
||||
#include <emscripten/html5.h>
|
||||
#include <GLES3/gl3.h>
|
||||
|
||||
|
|
@ -41,8 +44,13 @@ static void run_coroutine()
|
|||
std::fflush( stdout );
|
||||
}
|
||||
|
||||
static void render_frame()
|
||||
static bool g_done = false;
|
||||
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE void repro_tick()
|
||||
{
|
||||
if( g_done )
|
||||
return;
|
||||
|
||||
++g_frame;
|
||||
glClearColor( 0.1f, 0.2f, 0.3f, 1.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT ); // a real WebGL2 draw call before the coroutine
|
||||
|
|
@ -52,16 +60,24 @@ static void render_frame()
|
|||
std::printf( "[REPRO] frame %d: activating coroutine mid-GL-frame\n", g_frame );
|
||||
std::fflush( stdout );
|
||||
|
||||
run_coroutine(); // coroutine yields -> Asyncify rewinds the render frame
|
||||
run_coroutine(); // coroutine yields -> the frame activation suspends + resumes
|
||||
|
||||
glClearColor( 0.3f, 0.2f, 0.1f, 1.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT ); // another GL call after the coroutine resumes
|
||||
std::printf( "[REPRO] DONE\n" );
|
||||
std::fflush( stdout );
|
||||
emscripten_cancel_main_loop();
|
||||
g_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
// rAF driver over the promising tick export (each tick may suspend mid-frame).
|
||||
EM_JS( void, install_raf_driver, (), {
|
||||
const tick = () => {
|
||||
Promise.resolve( _repro_tick() ).then( () => requestAnimationFrame( tick ) );
|
||||
};
|
||||
requestAnimationFrame( tick );
|
||||
} );
|
||||
|
||||
int main()
|
||||
{
|
||||
EmscriptenWebGLContextAttributes attrs;
|
||||
|
|
@ -73,6 +89,7 @@ int main()
|
|||
std::printf( "[REPRO] start; WebGL2 context=%d\n", (int) g_ctx );
|
||||
std::fflush( stdout );
|
||||
|
||||
emscripten_set_main_loop( render_frame, 0, 0 );
|
||||
install_raf_driver();
|
||||
emscripten_exit_with_live_runtime(); // main returns; rAF drives repro_tick
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,26 @@
|
|||
// Reproduction probe #4: activate the coroutine from inside an emscripten_set_main_loop
|
||||
// (requestAnimationFrame) callback — the SINGLE JS->wasm boundary KiCad actually uses
|
||||
// (rAF -> callUserCallback -> iterFunc -> dynCall_v -> wasm refresh -> tool coroutine).
|
||||
// The crash trace's "main-refresh ctx=#2" is exactly this. Unlike the EM_JS/embind probes,
|
||||
// there is NO synchronous JS frame sitting above the coroutine — the coroutine runs in a
|
||||
// wasm chain below dynCall_v, so the Asyncify rewind re-enters via dynCall_v (like KiCad).
|
||||
// Reproduction probe #4: activate the coroutine from inside the rAF-driven tick —
|
||||
// the SINGLE JS->wasm boundary KiCad actually uses. Asyncify-era shape: rAF ->
|
||||
// callUserCallback -> iterFunc -> dynCall_v -> wasm refresh -> tool coroutine, via
|
||||
// emscripten_set_main_loop. JSPI (2026-08-13): a plain main-loop callback cannot
|
||||
// suspend ("SuspendError: trying to suspend without WebAssembly.promising"), and the
|
||||
// shipped app doesn't use emscripten_set_main_loop anymore — wx drives rAF ticks
|
||||
// through PROMISING exports (wxWasmTopLevelTick et al). This probe mirrors that: a JS
|
||||
// rAF driver calls the exported repro_tick(), which is on the target's JSPI_EXPORTS
|
||||
// list, so the coroutine suspends mid-tick exactly like a tool coroutine mid-refresh.
|
||||
//
|
||||
// No-wx + pthreads. Firefox should reach "[REPRO] DONE"; if system Chrome crashes before
|
||||
// DONE, the main-loop/rAF activation is the missing factor.
|
||||
// No-wx + pthreads. Both engines should reach "[REPRO] DONE".
|
||||
|
||||
#include "kicad_coroutine_harness.h"
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/em_js.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
using coroutine_test::TestCoroutine;
|
||||
|
||||
static int g_frame = 0;
|
||||
static bool g_done = false;
|
||||
|
||||
static void run_coroutine()
|
||||
{
|
||||
|
|
@ -26,7 +30,7 @@ static void run_coroutine()
|
|||
self.Yield( 42 );
|
||||
} );
|
||||
|
||||
bool running = co.Call( 1 ); // unwinds the main-loop callback back to dynCall_v; yields back
|
||||
bool running = co.Call( 1 ); // suspends the tick's promising activation; yields back
|
||||
std::printf( "[REPRO] after Call: running=%d lastValue=%ld\n",
|
||||
(int) running, (long) co.LastReturnValue() );
|
||||
std::fflush( stdout );
|
||||
|
|
@ -36,8 +40,11 @@ static void run_coroutine()
|
|||
std::fflush( stdout );
|
||||
}
|
||||
|
||||
static void main_loop_iter()
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE void repro_tick()
|
||||
{
|
||||
if( g_done )
|
||||
return;
|
||||
|
||||
++g_frame;
|
||||
std::printf( "[REPRO] main-loop frame %d\n", g_frame );
|
||||
std::fflush( stdout );
|
||||
|
|
@ -49,14 +56,27 @@ static void main_loop_iter()
|
|||
run_coroutine();
|
||||
std::printf( "[REPRO] DONE\n" );
|
||||
std::fflush( stdout );
|
||||
emscripten_cancel_main_loop();
|
||||
g_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
// rAF driver calling the PROMISING tick export (the glue wraps every
|
||||
// JSPI_EXPORTS entry with WebAssembly.promising, so each tick may suspend).
|
||||
EM_JS( void, install_raf_driver, (), {
|
||||
const tick = () => {
|
||||
Promise.resolve( _repro_tick() ).then( () => {
|
||||
if( !Module.__reproDone )
|
||||
requestAnimationFrame( tick );
|
||||
} );
|
||||
};
|
||||
requestAnimationFrame( tick );
|
||||
} );
|
||||
|
||||
int main()
|
||||
{
|
||||
std::printf( "[REPRO] start; installing emscripten_set_main_loop (rAF)\n" );
|
||||
std::printf( "[REPRO] start; installing rAF driver over the promising tick export\n" );
|
||||
std::fflush( stdout );
|
||||
emscripten_set_main_loop( main_loop_iter, 0, 0 ); // main returns; rAF drives main_loop_iter
|
||||
install_raf_driver();
|
||||
emscripten_exit_with_live_runtime(); // main returns; rAF drives repro_tick
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue