fix: update output callback to use OutputCallbackJs for improved memory management#2133
Merged
GustavoA1604 merged 5 commits intoMay 21, 2026
Merged
Conversation
… OutputCallbackJs
GustavoA1604
approved these changes
May 21, 2026
ishanvohra2
approved these changes
May 21, 2026
4 tasks
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.
🎯 What problem does this PR solve?
WhisperOutputCallBackJssubclass introduced in0.7.0as a workaround for the iOS bare-kittranscribe()-after-unload()crash (Mach exception 309 / EXC_BAD_ACCESS / PAC failure insidejs_delete_reference/js_open_handle_scope).setImmediate × 2defensive yield inWhisperInterface.destroyInstance(), both of which are no longer needed.qvac-lib-inference-addon-cpp1.1.6/1.1.7 deferringjs_delete_reference()into auv_closeclose-callback that races workletjs_env_t*invalidation on iOS — has now been fixed inqvac-lib-inference-addon-cpp@1.2.0, whichtranscription-whispercppalready depends on (vcpkg.jsonrequires>=1.2.0).📝 How does it solve it?
packages/transcription-whispercpp/addon/src/addon/WhisperOutputCallbackJs.hpp(~298 lines) and its#includefromAddonJs.hpp.createInstanceinaddon/src/addon/AddonJs.hppnow constructs the upstreamqvac_lib_inference_addon_cpp::OutputCallBackJsdirectly (1.2.0 ordering:deleteJsReferences()runs synchronously inside~OutputCallBackJs(), beforeuv_close, so the close-callback never touchesjs_env_t*).await new Promise(resolve => setImmediate(resolve))belt-and-braces yields inWhisperInterface.destroyInstance()plus the long defense-in-depth comment that explained them — the close-callback is now safe regardless of when libuv runs it.🧪 How was it tested?
transcription-whispercppforios-arm64againstqvac-lib-inference-addon-cpp@1.2.0from the registry (no overlay-port, no patched destructor).tests-qvactranscription suite on a physical iPhone vianpx qvac-test run:local:ios --filter transcription:task_vm_info.physFootprint≈ 417 MB.transcribeStreamevent tests, includingtranscribe-stream-events-happy/disabled/invalid(which exercise the streaming destruction path that originally triggered the crash on iOS bare-kit with 1.1.7)..bareinstalled into the consumer matched the UUID of the freshly-builtprebuilds/ios-arm64/qvac__transcription-whispercpp.bare(the framework only differs in code signature).💥 Breaking Changes
None. Public JS API (
WhisperInterface,runStreaming,transcribeStream,unload, etc.) is unchanged. The whisper-local C++ subclass was an internal implementation detail.🔌 API Changes
None.
📦 Version bump
packages/transcription-whispercpp/package.jsonstill reports0.7.0. This PR reverts a0.7.0fix and needs a follow-up bump (suggested0.7.1) plus a matchingCHANGELOG.mdentry, e.g.: