Repository navigation
pycvc-gl wasm: link the host with -fexceptions (v3.7.9 publish failure) - #1020
Merged
Merged
Conversation
ubuntu-latest now runs ubuntu-26.04 with GCC 15.2, whose libstdc++ no
longer brings <algorithm> in through <random>, <thread> and the rest.
state_compression_registry_test stopped compiling on every Linux job
("'sort' is not a member of 'std'"). state_brick_frustum_test's
std::find leaned on the same transitive include. A scan of src, inc,
examples and bindings found no other file calling an <algorithm> or
<numeric> function without reaching the header itself.
(cherry picked from commit e8ec8e7)
The v3.7.9 tag's publish-pycvc-gl-wasm run failed at the host smoke: right after PYCVC_VTK_BRIDGE_OK, pycvc_host aborted under node with "Aborted(undefined)" from ___cxa_throw. cvc, cvcGL and the SWIG wrappers are compiled with -fexceptions (the top-level CMakeLists.txt adds it under Emscripten). link-host.sh's emcc line had no -fexceptions, so emscripten linked the host with exception catching off, and __cxa_throw became a bare abort(). Every throw then ends the program, even one that a catch would take. Up to v3.7.8 the default script only imported modules, and nothing threw. v3.7.9 (#961) added Exec(make_app()) running a with-lock, the host's first call into libcvc. Its cvc::state::instance() on the new app throws and catches a boost::bad_any_cast on its first lookup of the root. An -sASSERTIONS --profiling-funcs link names that throw: boost::throw_exception<boost::bad_any_cast>, from app::data<boost::shared_ptr<cvc::state>>, from state::instancePtr.
Two gaps stopped the recipe's Windows-host wasm build: - SWIG_DIR: the windows swig bundle keeps its library beside swig.exe (bin/Lib), not under share/swig/<ver>. The script found nothing, passed an empty SWIG_DIR, and configure failed "Could NOT find SWIG (missing: SWIG_DIR)". It now falls back to bin/Lib. - cvcGL adds its test executables unconditionally, and some of them fail to link: on Linux, emscripten_fetch without -sFETCH; here, wasm-ld ran out of memory on four of them. The shared Invoke-CvcWasmCMakeBuild threw on the first failure. build-wasm.sh presses on with -- -k 0. The helper gains an opt-in -KeepGoing that does the same, and this recipe uses it. The other recipes are unchanged. The recipe then checks that _pycvc.a and _pycvc_gl.a were installed, as build-wasm.sh does.
ubuntu-latest became the 26.04 image (gcc 15.2), and the jobs that used it broke on a std::sort without <algorithm>: a toolchain no published bundle is built with. publish-cvcpkg.yml already pins its linux targets to ubuntu-22.04 (glibc 2.35, gcc 11.4), because an artifact built on a newer image carries GLIBC_2.x versions an older system can't load. Pinned to ubuntu-22.04: ci.yml's package-linux and pycvc-linux, ci-recipe.yml's two linux lanes, and release.yml's linux job (the SDK archives) and its linux sdk-smoke lanes. (cherry picked from commit e59cbf2)
test_a_python_kernels_wait_for_the_gil_isnt_charged stamps window["from"] in Python and then makes the C call that holds the GIL. Between the two the interpreter can hand the GIL to the waiting kernel thread, at an eval-breaker check, when `hold` is preempted on a busy machine. The kernel then runs just after the stamp, with no wait, and the precondition assert (ran_at - from >= 0.2) failed on pycvc-linux / cp312. Such a try is now retried like the other no-wait cases: a kernel that waited ran after the C call, at about window["to"].
…'s required checks
The first fix did not hold: pycvc-linux / cp312 failed the same precondition at 3ab5cd2, with the kernel past the hold's end. The hold itself ran short of its 0.3 s. _PER_ITEM is the best of five runs at import, and when every run is slow (a busy runner, a frequency step) each sum(range(n)) finishes early, so ran_at - window["from"] < 0.2 even though the kernel waited the hold out. A try whose hold is under 0.25 s now raises what the next hold asks for by 0.3 / held (at most 3 s) and tries again. A handover before the C call and an over-long hold count as stalls, as before. Checked against the build-ariglx pycvc on Windows: with _PER_ITEM made 2x and 4x pessimistic the old test fails 2 and 3 runs of 3 and this one passes all of them, with no skips, and the whole file passes 3 of 3.
…-includes # Conflicts: # bindings/pycvc/test_pycvc_state_exec_async.py
…he GIL wait test)
transfix
added a commit
that referenced
this pull request
Nov 7, 2026
…e) (#1020) The v3.7.9 tag's publish-pycvc-gl-wasm run failed at the host smoke: right after PYCVC_VTK_BRIDGE_OK, pycvc_host aborted under node with "Aborted(undefined)" from ___cxa_throw. cvc, cvcGL and the SWIG wrappers compile with -fexceptions, but link-host.sh's emcc line did not pass it. So emscripten linked the host with exception catching off, and every throw aborted, even one a catch would take. v3.7.9's smoke added Exec(make_app()) (#961), and on a new app cvc::state::instance() throws and catches a boost::bad_any_cast. The link now passes -fexceptions. Separately, build-wasm.ps1 builds on a Windows host: - it finds the windows swig bundle's library in bin/Lib; - it presses past cvcGL's test executables when their links fail, through an opt-in -KeepGoing on Invoke-CvcWasmCMakeBuild, as build-wasm.sh does with -k 0; - it checks that _pycvc.a and _pycvc_gl.a were installed. (cherry picked from commit 7a5d94a)
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.
The v3.7.9 tag's
publish-pycvc-gl-wasmrun (41746570132) failed at "Smoke the installed host". Right afterPYCVC_VTK_BRIDGE_OK,pycvc_hostaborted under node withAborted(undefined)from___cxa_throw.Cause
cvc, cvcGL and the SWIG wrappers are compiled with
-fexceptions. The top-levelCMakeLists.txtadds it under Emscripten, because cvc throws and catches as part of its API.bindings/pycvc/wasm/link-host.shlinks the host with its own emcc line, and that line had no-fexceptions. Emscripten therefore linked with exception catching off (DISABLE_EXCEPTION_CATCHING), and__cxa_throwbecame a bareabort(). Every throw ends the program, including one that acatchwould take.Through v3.7.8 the default smoke script only imported modules, and nothing threw. #961 added
Exec(make_app())running awith-lock, the host's first call into libcvc. In theExecconstructor,cvc::state::instance()on the new app looks up the root withapp::data<state_ptr>("__state"). That throwsboost::bad_any_cast, and thecatchcreates the root. An-sASSERTIONS --profiling-funcslink of the same host names that throw:Changes
link-host.sh: link with-fexceptions, and say why in its list of key facts.build-wasm.ps1(a separate commit): the recipe's Windows-host wasm build, which is how this was verified.bin/Lib. Before, configure failed with "Could NOT find SWIG (missing: SWIG_DIR)".build-wasm.sh's-- -k 0does. This uses a new opt-in-KeepGoingonInvoke-CvcWasmCMakeBuild, which no other recipe uses._pycvc.aand_pycvc_gl.awere installed.The three files are the same in v3.7.9 and master, so both commits apply to v3.7.9 as they are.
Verification
All on a Windows host (sandipaws), with the wasm deps from
cvcpkg install-deps cvcpkg/recipes/pycvc-gl-cp312 --platform wasmplus freetype, assimp and imgui, as the workflow installs them, and emsdk 5.0.7 with its node 22.16.0.cvcpkg build pycvc-gl-cp312 --platform wasm --host-platform windows: configure passes, and the closure builds with-k 0.wasm-opt -O3here.cmake --build --target pycvc pycvc_gl cvc cvcGL,cmake --install, andlink-host.shwith the environmentbuild-wasm.ps1passes it.link-host.shreproduces the failure:Aborted(undefined)from___cxa_throwafterPYCVC_VTK_BRIDGE_OK, with the sameinvoke_vi/invoke_viii/invoke_iistack as the run.link-host.sh(NODE set) exits 0. The workflow's smoke step, run on the installed host, passes: node exits 0, and the output hasPYCVC_VTK_BRIDGE_OK,PYCVC_EXEC_OKandPYCVC_WASM_OK.if: always(), so a dry run would upload a 68 MB artifact too.Not fixed here
The "Exception ignored in garbage collection ...
_lock_unlock_module...'<garbage>' object is not callable" lines duringimport pycvc_glare in v3.7.8's passing run too.-sSAFE_HEAP=1link segfaults there.vtkPythonUtil::AddModulecallsPyObject_CallObjecton an object whose type is garbage, while pycvc_gl's import pulls invtkmodules.vtkRenderingCore/vtkRenderingOpenGL2.-sASSERTIONS, the host also reports at exit that address zero was overwritten.--allow-multiple-definitionstatic link, rather than at this change.