[quickjs-devel] Re: assert after exception in JS_FreeRuntime

  • From: JM <jeevhi@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Mon, 20 Jan 2020 14:03:00 +0530

requesting to ignore. I overlooked to free a value.

On Mon, Jan 20, 2020 at 10:46 AM JM <jeevhi@xxxxxxxxx> wrote:


Following Javascript causes an exception which is understandable. However,
when I try to free the runtime after the exception, it raises assert on
line 1789 (latest quickjs-2020-01-05)



*var obj = null;obj.test = "crash it";*

Below is the code

        JSValue result = JS_EvalFunction(ctx, bc);

        if (JS_IsException(result)) {
                JS_ResetUncatchableError(ctx);
         }

        JS_FreeValue(ctx, result);
        JSRuntime *rt = JS_GetRuntime(ctx);
        JS_FreeContext(ctx);
        JS_FreeRuntime(rt);

Below is the assert log
js: quickjs.c:1789: JS_FreeRuntime: Assertion
`list_empty(&rt->gc_obj_list)' failed.

Below is the stacktrace
#0  0x00007f04cbcbc93f in raise () from /lib64/libc.so.6
#1  0x00007f04cbca6c95 in abort () from /lib64/libc.so.6
#2  0x00007f04cbca6b69 in __assert_fail_base.cold.0 () from
/lib64/libc.so.6
#3  0x00007f04cbcb4df6 in __assert_fail () from /lib64/libc.so.6
#4  0x000000000041a6fe in JS_FreeRuntime (rt=0x1d39620) at quickjs.c:1789

Other related posts: