Crash with Gio.Resolver
It seems like there might be a reference-counting issue with the returned GList
of GVariant
.
Reproducer:
#!/usr/bin/env -S gjs -m
import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
const resolver = Gio.Resolver.get_default();
const records = resolver.lookup_records('gnome.org',
Gio.ResolverRecordType.MX, null);
for (const record of records)
console.log(record.print(true));
Stack Trace:
Thread 1 "gjs" received signal SIGSEGV, Segmentation fault.
g_variant_type_info_check (info=info@entry=0x7fffc4001, container_class=container_class@entry=0 '\000')
at ../glib/gvarianttypeinfo.c:168
Downloading source file /usr/src/debug/glib2-2.80.0-1.fc40.x86_64/redhat-linux-build/../glib/gvarianttypeinfo.c
168 g_assert (info->alignment == 0 || info->alignment == 1 ||
(gdb) bt
#0 g_variant_type_info_check (info=info@entry=0x7fffc4001, container_class=container_class@entry=0 '\000')
at ../glib/gvarianttypeinfo.c:168
#1 0x00007ffff7db1707 in g_variant_type_info_get_type_string (info=0x7fffc4001) at ../glib/gvarianttypeinfo.c:205
#2 0x00007ffff7da3393 in g_variant_print_string (value=0x7fffc40015d0, string=string@entry=0x0, type_annotate=1)
at ../glib/gvariant.c:2218
#3 0x00007ffff7da5061 in g_variant_print (value=<optimized out>, type_annotate=<optimized out>)
at ../glib/gvariant.c:2657
#4 0x00007ffff7a7a056 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#5 0x00007ffff7a766a0 in ffi_call_int
(cif=cif@entry=0x7fffc4001640, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
#6 0x00007ffff7a794ee in ffi_call
(cif=0x7fffc4001640, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>)
at ../src/x86/ffi64.c:710
#7 0x00007ffff7ea0eee in Gjs::Function::invoke
(this=0x7fffc4001620, context=0x5555555b6bc0, args=<optimized out>, this_obj=..., r_value=<optimized out>)
at ../gi/function.cpp:1056
#8 0x00007ffff7ea2313 in Gjs::Function::call (context=0x5555555b6bc0, js_argc=<optimized out>, vp=<optimized out>)
at ../gi/function.cpp:1238
#9 0x00007ffff687cb64 in CallJSNative
(args=..., reason=js::CallReason::Call, native=0x7ffff7ea2230 <Gjs::Function::call(JSContext*, unsigned int, JS::Value*)>, cx=0x5555555b6bc0) at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:486
#10 js::InternalCallOrConstruct
(cx=0x5555555b6bc0, args=..., construct=<optimized out>, reason=js::CallReason::Call)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:566
#11 0x00007ffff6886286 in InternalCall (reason=<optimized out>, args=<optimized out>, cx=<optimized out>)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:647
#12 js::CallFromStack (reason=<optimized out>, args=<optimized out>, cx=<optimized out>)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:652
#13 js::Interpret (cx=0x5555555b6bc0, state=...)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:3395
#14 0x00007ffff687c523 in MaybeEnterInterpreterTrampoline (state=..., cx=0x5555555b6bc0)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:400
#15 js::RunScript (cx=0x5555555b6bc0, state=...)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:458
#16 0x00007ffff6880b29 in js::ExecuteKernel
(cx=<optimized out>, script=..., envChainArg=..., evalInFrame=..., result=...)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Interpreter.cpp:845
#17 0x00007ffff68d2ff1 in js::ModuleObject::execute (cx=<optimized out>, self=...)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/builtin/ModuleObject.cpp:1284
#18 0x00007ffff69933ab in ExecuteAsyncModule (module=..., cx=0x5555555b6bc0)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Modules.cpp:1558
#19 InnerModuleEvaluation
(cx=cx@entry=0x5555555b6bc0, module=module@entry=..., stack=stack@entry=..., index=<optimized out>,
index@entry=0, indexOut=indexOut@entry=0x7fffffffdb00)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Modules.cpp:1492
#20 0x00007ffff69936eb in js::ModuleEvaluate (result=..., moduleArg=..., cx=0x5555555b6bc0)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Modules.cpp:1284
#21 JS::ModuleEvaluate (cx=0x5555555b6bc0, moduleRecord=..., moduleRecord@entry=..., rval=rval@entry=...)
at /usr/src/debug/mozjs115-115.7.0-1.fc40.x86_64/vm/Modules.cpp:163
#22 0x00007ffff7edcc28 in GjsContextPrivate::eval_module
(this=0x5555555ad630, identifier=0x5555556edf90 "file:///var/home/andrew/Projects/GNOME/gnome-online-accounts/dav-srv.js", exit_status_p=0x7fffffffddf8 "", error=0x7fffffffde08) at /usr/include/mozjs-115/js/RootingAPI.h:1219
#23 gjs_context_eval_module
(js_context=<optimized out>, identifier=0x5555556edf90 "file:///var/home/andrew/Projects/GNOME/gnome-online-accounts/dav-srv.js", exit_code=0x7fffffffddf8 "", error=0x7fffffffde08) at ../gjs/context.cpp:1387
#24 0x00005555555573f1 in define_argv_and_eval_script
(js_context=0x5555555ad7d0, argc=<optimized out>, argv=<optimized out>, script=0x5555555a8750 "#!/usr/bin/env -S gjs -m\n\nimport GLib from 'gi://GLib';\nimport Gio from 'gi://Gio';\n\nconst resolver = Gio.Resolver.get_default();\nconst records = resolver.lookup_records('_caldavs._tcp.mailbox.org',\n "..., len=306, filename=<optimized out>)
at ../gjs/jsapi-util.h:163
#25 main (argc=<optimized out>, argv=<optimized out>) at ../gjs/console.cpp:393