flathub / org.electronjs.Electron2.BaseApp

7 stars 16 forks source link

23.08 with libnotify 0.8.2 leads to segfaults when clicking on desktop notifications #47

Closed aquarichy closed 1 year ago

aquarichy commented 1 year ago

Element and Signal have both switch to 23.08 of both Freedesktop's platform images as well as this one of Electron. Now, when I and others receive notifications of new messages, if we click on them, libnotify segfaults and the app crashes.

Downstream issues:

Upstream issue:

I've run into a bit of a wall trying to debug this further. Bisecting and trying out different versions has gotten me pretty far, but ultimately I can't see exactly where the crash is happening.

Steps taken so far

$ flatpak install org.freedesktop.Sdk.Debug
$ flatpak install org.electronjs.Electron2.BaseApp.Debug
... rebuild Riot from master ...
$ flatpak run --devel --command=sh im.riot.Riot
[📦 im.riot.Riot ~]$ cd /app/bin/ && ./element
[📦 im.riot.Riot ~]$ gdb --pid=PID 

libnotify.so.4 remains opaque despite debug info getting downloaded:

Downloading separate debug info for /app/lib/libnotify.so.4

(element-desktop:7): libnotify-WARNING **: 18:44:49.883: Running in confined mode, using Portal notifications. Some features and hints won't be supported

Thread 1 "element-desktop" received signal SIGSEGV, Segmentation fault.
0x00007f3f6555c418 in ?? () from /app/lib/libnotify.so.4
(gdb) bt
#0  0x00007f3f6555c418 in  () at /app/lib/libnotify.so.4
#1  0x00007f3f6f9ae4ea in g_closure_invoke (closure=0x15a0015c69b0, return_value=0x0, n_param_values=4, param_values=0x7ffe74636dd0, invocation_hint=0x7ffe74636d50) at ../gobject/gclosure.c:832
#2  0x00007f3f6f9ddb86 in signal_emit_unlocked_R.isra.0
    (node=node@entry=0x15a0002e41c0, detail=detail@entry=0, instance=instance@entry=0x15a001b7d150, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffe74636dd0) at ../gobject/gsignal.c:3812
#3  0x00007f3f6f9ce92e in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffe74636fc0) at ../gobject/gsignal.c:3565
#4  0x00007f3f6f9cec03 in g_signal_emit (instance=instance@entry=0x15a001b7d150, signal_id=<optimized out>, detail=<optimized out>) at ../gobject/gsignal.c:3622
#5  0x00007f3f6f79c17b in on_signal_received
    (connection=<optimized out>, sender_name=0x15a0015bd410 ":1.75", object_path=<optimized out>, interface_name=<optimized out>, signal_name=0x15a001428480 "ActionInvoked", parameters=0x15a001e215e0, user_data=0x15a0024db4b0)
    at ../gio/gdbusproxy.c:890
#6  0x00007f3f6f7878e0 in emit_signal_instance_in_idle_cb (data=0x15a002f35a00) at ../gio/gdbusconnection.c:3802
#7  0x00007f3f6f8add36 in g_main_dispatch (context=0x193800241b00) at ../glib/gmain.c:3460
#8  g_main_context_dispatch (context=0x193800241b00) at ../glib/gmain.c:4200
#9  0x00007f3f6f90b2b8 in g_main_context_iterate.isra.0 (context=context@entry=0x193800241b00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4276
#10 0x00007f3f6f8ab513 in g_main_context_iteration (context=0x193800241b00, may_block=1) at ../glib/gmain.c:4343
#11 0x000055708988f614 in  ()
#12 0x000015a0011d6cb0 in  ()
#13 0x0000000000000000 in  ()
(gdb)

So I can't quite tell if it's a bug specifically in libnotify's code or if it's specifically in the Flatpak build/configuration in org.electronjs.Electron2.BaseApp :|

I'm happy to investigate further if anyone has any advice.

bbhtt commented 1 year ago

It's a bug in libnotify (specifically when it uses portals), we have to wait for a fix there.

The original libnotify issue contains a good enough backtrace.

aquarichy commented 1 year ago

https://gitlab.gnome.org/GNOME/libnotify/-/issues/34

There's progress. The commits from today fixed the issue for me. Hopefully they merge them soon. :)