ags crashes with too many notifications. Won't start.
Closed this issue · 6 comments
I let my laptop sit for a while and I returned with over 100 notifications, maybe 150. I clicked the notification panel so I could clear it, it hung for a moment then crashed.
When trying to start ags I get the following error:
(com.github.Aylur.ags:4981): Gdk-CRITICAL **: 22:57:00.264: ../gtk/gdk/wayland/gdkdisplay-wayland.c:1433: Unable to create Cairo image surface: invalid value (typically too big) for the size of the input (surface, pattern, etc.)
[1] 4981 segmentation fault (core dumped) ags
- Distribution: Arch
- Window Manager/Desktop Environment: Hyprland
I tried to ask the ags github about it and I received the following response.
"this assertion error might be triggered if your Gtk.Window exceeds a specific size, your window gets so big that Gdk couldn't make a surface for it, and if it could make one, bad things would happen
you better consider how you manage your window, for example you can limit your widget to not exceed a certain size by packing it inside a scrollable"
Have you updated HyprPanel? This should have been fixed by #199
Alright so with your advice, I updated HyprPanel and it was able to start. It did have some interesting behavior though. I was able to open my notification panel with 145 alerts. I clicked Clear Notifications, and it hang for a moment. Soon after the console spit out these:
(com.github.Aylur.ags:51254): Gjs-CRITICAL **: 14:49:35.363: Attempting to call back into JSAPI during the sweeping phase of GC. This is most likely caused by not destroying a Clutter actor or Gtk+ widget with ::destroy signals connected, but can also be caused by using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked and the JS callback not invoked.
The offending signal was enter-notify-event on Ags_Scrollable 0x5fff517cdcd0.
== Stack trace for context 0x5fff50069900 ==
#0 5fff501315f8 i resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266 (20cb3867d560 @ 139)
I got a ton of this exact error.
I restarted AGS and now I have fewer notifications.... Ended up at something like 25.
I was then able to clear the remaining notifications.
It's now usable, although I do feel like if I let the notifications stack significantly, it could crash on me in a similar way again.
You can try to replicate the failure with:
for i in {1..100}; do notify-send "Testing Notification" "This is a notification body message"; sleep 0.1; done
This will send 100 notifications.
Edit: This will definitely prevent that Cairo error you received since the box is a static height with a scroller and pagination. It also renders 10 notifications on the screen max, by default (configurable) .
Hopefully when you run that command above you can verify that there is no lag. Matter you fact you can probably increase it to a 1000 and it should not cause issues (hopefully 😉 ).
Now that's a nifty command. I ran it several times and while it was mostly fine, it did crash again. It's not consistent though. Clicking the notifications icon sometimes causes it to crash, sometimes it's fine. Not sure what's causing the crash this time since AGS isn't spitting out useful info into the console. All it gives me is Gdk-Message: 08:52:27.539: Lost connection to Wayland compositor.
when it crashes.
Regardless, it seems to be much better than before and I can work around it. If you know how I can access more detailed logs for the crash, I'll provide them. Otherwise, I appreciate your help.
That error is a GTK issue where it forcefully terminates the process instead of giving us a chance to handle the error gracefully.
Unfortunately it's just some GTK funkyness and hopefully it's not frequent for you (shouldn't be).
Thanks again for the help! Really enjoying HyprPanel.