The libggml-metal static destructor asserts on a non-empty residency-set collection during __cxa_finalize_ranges, dumping a multi-kB GGML backtrace after successful output (ggml-org/llama.cpp#22593, one-line fix open as PR #22595). The assertion only trips when process.exit() skips Node's beforeExit hook — which is exactly the hook node-llama-cpp registers to auto-dispose its native handles. Primary fix: finishSuccessfulCliCommand now sets process.exitCode = 0 and returns instead of calling process.exit(0). The event loop drains, beforeExit fires, native Metal resources tear down in order, and the process exits cleanly even without the workaround env var. Defense-in-depth retained: bin/qmd and scripts/test-all.mjs still export GGML_METAL_NO_RESIDENCY=1 on darwin for error paths and tests that terminate via process.exit(). Opt back in with QMD_METAL_KEEP_RESIDENCY=1. Also: correct upstream issue refs (was #17869 → now #22593/#22595). Add scripts/repro-metal-rsets-crash.mjs minimal reproduction. |
||
|---|---|---|
| .. | ||
| build.mjs | ||
| check-package-grammars.mjs | ||
| extract-changelog.sh | ||
| install-hooks.sh | ||
| package-smoke.mjs | ||
| pre-push | ||
| release.sh | ||
| repro-metal-rsets-crash.mjs | ||
| test-all.mjs | ||