reearth / quickjs-emscripten-sync

Provides a way to sync objects between browser and QuickJS
MIT License
62 stars 7 forks source link

[C to host error: returning null] Error: QuickJSContext had no callback with id -xxxx #20

Closed rot1024 closed 1 year ago

rot1024 commented 1 year ago

When repeating calling a function, an error occurs from quickjs-emscripten.

import { getQuickJS } from "quickjs-emscripten";
import { expect, test } from "vitest";
import { Arena } from ".";

test(
  "repeated function",
  async () => {
    const rt = (await getQuickJS()).newRuntime();
    const ctx = rt.newContext();
    const arena = new Arena(ctx, { isMarshalable: true });

    vm.expose({ hoge: () => {} });
    // error happens from 3926 times on my machine
    for (let i = 0; i < 3926; i++) {
      // arg should be an object
      arena.evalCode(`hoge({})`);
    }

    arena.dispose();
    ctx.dispose();
    rt.dispose();
  },
  1000 * 60,
);
rot1024 commented 1 year ago

reported at https://github.com/justjake/quickjs-emscripten/issues/98

rot1024 commented 1 year ago

This issue is already fixed. I forgot closing it