Skip to content

fix: swap runtime disposal ordering in asyncify variant#256

Open
hectorm wants to merge 1 commit intojustjake:mainfrom
hectorm:asyncify-runtime-disposal-ordering
Open

fix: swap runtime disposal ordering in asyncify variant#256
hectorm wants to merge 1 commit intojustjake:mainfrom
hectorm:asyncify-runtime-disposal-ordering

Conversation

@hectorm
Copy link

@hectorm hectorm commented Mar 7, 2026

While upgrading to 0.32.0 I ran into this error when host functions (created via newFunction()) were still referenced at teardown:

QuickJSRuntime(rt = 5333456) not found when trying to free HostRef(id = -2147483648)

After digging into it, the cause is that module-asyncify.ts calls deleteRuntime() before QTS_FreeRuntime(), so by the time GC runs the host_ref_finalizer for HostRef objects, the runtime's callbacks are already gone from the map.

I just copied into module-asyncify.ts the same changes made to module.ts in #227 (reference).

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.

1 participant