-
Notifications
You must be signed in to change notification settings - Fork 126
Multiple sequential await calls in evalCodeAsync fail with "Lifetime not alive" #258
Copy link
Copy link
Open
Description
When using newAsyncContext() with newAsyncifiedFunction(), the first await on a host function works correctly, but the second sequential await causes "Lifetime not alive" errors and crashes with Assertion failed: list_empty(&rt->gc_obj_list).
Reproduction:
import { newAsyncContext } from "quickjs-emscripten";
const ctx = await newAsyncContext();
const fn = ctx.newAsyncifiedFunction("get", async (...args) => {
const path = ctx.dump(args[0]);
return ctx.newString(JSON.stringify({ path }));
});
ctx.setProp(ctx.global, "get", fn);
fn.dispose();
// Single await - WORKS
const r1 = await ctx.evalCodeAsync(`(async () => { return await get("/a") })()`);
// Two sequential awaits - CRASHES
const r2 = await ctx.evalCodeAsync(`
(async () => {
const a = await get("/a");
const b = await get("/b"); // Crashes here
return [a, b];
})()
`);Expected: Both awaits resolve sequentially.
Actual: Second await causes QuickJSUseAfterFree: Lifetime not alive followed by Assertion failed: list_empty(&rt->gc_obj_list) on runtime disposal.
The issue is in quickjs-emscripten v0.32.0 with the ASYNCIFY variant.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels