phuhl/linux_notification_center

Crash after a system suspend

Closed this issue ยท 10 comments

src/NotificationCenter/NotificationInCenter.hs:(60,7)-(61,27): Irrefutable pattern failed for pattern Just noti

phuhl commented

Hi @AlecsFerra, can you elaborate under which circumstances this happens? Never happend to me, yet.

I can't really reproduce this in a deterministic way, I just put my pc on sleep mode and sometimes when unsleep the pc the program crashed (non exhaustive pattern) in the pr you can see what pattern failed.

Something similar happens to me. Crashes are happening with the pre-compiled version https://github.com/phuhl/linux_notification_center/blob/361d22126ace552b8a95e416bc4bd04f2e04b29b/.out/deadd-notification-center

These crashes sometimes happen after resume, sometimes on repeated notifications. My guess is either some ill-formed notifications or some race condition inside the code are the trigger of the crashes. For instance:

May 16 12:34:20 pavonis CMST[4197]: Could not create an interface to connman-vpn on the system bus
May 16 12:34:21 pavonis dbus-daemon[4203]: [session uid=0 pid=4201] Activating service name='org.freedesktop.Notifications' requested by ':1.0' (uid=0 pid=4197 comm="cmst")
May 16 12:34:21 pavonis dbus-daemon[4203]: [session uid=0 pid=4201] Successfully activated service 'org.freedesktop.Notifications'
May 16 12:34:21 pavonis dbus-daemon[4203]: [session uid=0 pid=4201] Activating service name='org.gtk.vfs.Daemon' requested by ':1.8' (uid=0 pid=4254 comm="/usr/bin/deadd-notification-center")
May 16 12:34:21 pavonis dbus-daemon[4203]: [session uid=0 pid=4201] Successfully activated service 'org.gtk.vfs.Daemon'
May 16 12:34:21 pavonis kernel: deadd-notificat[4254]: segfault at 0 ip 0000000005b666e7 sp 00007ffd509bb370 error 6 in deadd-notification-center[400000+59bf000] likely on CPU 4 (core 0, socket 0)
May 16 12:34:21 pavonis kernel: Code: df e8 dd e9 00 00 48 89 d8 5b 5d 41 5c c3 0f 1f 44 00 00 83 ff 05 7f 90 e8 a6 e9 00 00 48 89 c3 48 b8 4d 89 c1 49 89 c8 48 89 <48> 89 03 48 b8 d1 48 89 f2 48 89 fe 48 4c 89 63 20 48 89 43 08 48
May 18 20:54:03 pavonis sudo[29262]: user : PWD=/home/user ; USER=root ; COMMAND=/usr/local/sbin/lcd-brightness -% IV
May 18 20:54:03 pavonis sudo[29262]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
May 18 20:54:03 pavonis sudo[29262]: pam_unix(sudo:session): session closed for user root
May 18 20:54:03 pavonis dbus-daemon[30388]: [session uid=1000 pid=30386] Activating service name='org.freedesktop.Notifications' requested by ':1.1070' (uid=1000 pid=29272 comm="/usr/bin/python3.10 /usr/lib/python-exec/python3.1")
May 18 20:54:03 pavonis dbus-daemon[30388]: [session uid=1000 pid=30386] Successfully activated service 'org.freedesktop.Notifications'
May 18 20:54:03 pavonis kernel: deadd-notificat[29274]: segfault at 0 ip 0000000005b666e7 sp 00007fff21acb350 error 6 in deadd-notification-center[400000+59bf000] likely on CPU 4 (core 0, socket 0)
May 18 20:54:03 pavonis kernel: Code: df e8 dd e9 00 00 48 89 d8 5b 5d 41 5c c3 0f 1f 44 00 00 83 ff 05 7f 90 e8 a6 e9 00 00 48 89 c3 48 b8 4d 89 c1 49 89 c8 48 89 <48> 89 03 48 b8 d1 48 89 f2 48 89 fe 48 4c 89 63 20 48 89 43 08 48

Although I cannot reproduce it 100%, I have been able to crash it both using notify-send.py and notify-send

user@pavonis[2]:/usr/local/sbin> notify-send -t 1000 "LCD Brightness" "10 %" -e --hint string:image-path:video-display --hint int:has-percentage:10
GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
user@pavonis[3]:/usr/local/sbin> notify-send -t 1000 "LCD Brightness" "10 %" -e --hint string:image-path:video-display --hint int:has-percentage:10
GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
user@pavonis[4]:/usr/local/sbin> notify-send -t 1000 "LCD Brightness" "10 %" -e --hint string:image-path:video-display --hint int:has-percentage:10
user@pavonis[5]:/usr/local/sbin>
phuhl commented

Very strange, still cannot reproduce it. If you find a way to reproduce, let me know. How often does it crash? What system are you on?

I have Gentoo Linux on a x86_64 laptop, using glibc 2.36, dbus 1.15.4 and an updated kernel (6.2.13 in previous tests, 6.3.3 just today).

The way I can get it crashing 95% of the times is just firing notifications from command line fast enough, then let it have a few seconds rest, then again firing. For instance, next bash script:

for B in $(seq 1 2) ; do
    for A in $(seq 1 50) ; do
        notify-send -t 1000 "LCD Brightness" "10 %" -e --hint string:image-path:video-display --hint int:has-percentage:10 -a foo -p
    done

    sleep 5
done

I have also been able to crash it with more simplified notification scenarios, like non transient notifications or no progress bar, but it seems to be harder to be fired.

Additional background: As the package is not available at any Gentoo overlay, and I did not want to pull all the development dependencies in order to compile it, I wrote my own ebuild recipe, which fetches the 2.0.2 release and uses the pre-compiled binary available in the release.

The recipe is available at https://github.com/jmfernandez/portage-inb-overlay/blob/1ca9abd3c77abaa5675346994ddb5ff6f54b4412/x11-misc/deadd-notification-center-bin/deadd-notification-center-bin-2.0.2.ebuild , and it installs next files:

pavonis ~ # cat /var/db/pkg/x11-misc/deadd-notification-center-bin-2.0.2/CONTENTS 
dir /etc
dir /etc/xdg
dir /etc/xdg/autostart
obj /etc/xdg/autostart/deadd-notification-center.desktop 726afc99f29115d99a4d17aaa8d43226 1681608071
dir /etc/xdg/deadd
obj /etc/xdg/deadd/deadd.css 9b0716441eda33ff52069cd6063a7144 1681608071
dir /usr
dir /usr/share
dir /usr/share/doc
dir /usr/share/doc/deadd-notification-center-bin-2.0.2
obj /usr/share/doc/deadd-notification-center-bin-2.0.2/LICENSE.bz2 287e1c5af0d8730da74acc8c4b99079d 1681608071
obj /usr/share/doc/deadd-notification-center-bin-2.0.2/README.org.bz2 fa42ef40729c055e289c5e45c5ec8a1c 1681608071
dir /usr/share/man
dir /usr/share/man/man1
obj /usr/share/man/man1/deadd-notification-center.1.bz2 18ab4438bcb7adcfaf01396f6f21b1b0 1681608071
dir /usr/share/dbus-1
dir /usr/share/dbus-1/services
obj /usr/share/dbus-1/services/com.ph-uhl.deadd.notification.service f581ac81eaef052edc01f96d4959caa3 1681608071
dir /usr/share/locale
dir /usr/share/locale/tr
dir /usr/share/locale/tr/LC_MESSAGES
obj /usr/share/locale/tr/LC_MESSAGES/deadd-notification-center.mo 7d8fb36950a5acd1786181b7c4361dad 1681608071
dir /usr/share/locale/en
dir /usr/share/locale/en/LC_MESSAGES
obj /usr/share/locale/en/LC_MESSAGES/deadd-notification-center.mo a6df84b7ae68eedbd953be6bf8298b32 1681608071
dir /usr/share/locale/de
dir /usr/share/locale/de/LC_MESSAGES
obj /usr/share/locale/de/LC_MESSAGES/deadd-notification-center.mo 4e589fe4eb906f64b3c2adc6d8f173f3 1681608071
dir /usr/share/locale/bn_BD
dir /usr/share/locale/bn_BD/LC_MESSAGES
obj /usr/share/locale/bn_BD/LC_MESSAGES/deadd-notification-center.mo 4f61dbb35832821550280055a2332fc4 1681608071
dir /usr/bin
obj /usr/bin/deadd-notification-center 08caba8ed9ffb4366c0719563e136816 1681608072

Hope this helps!

phuhl commented

Using your script I can get the issue from #218 so maybe it's the same on your system just a different error message? In that case, only thing we can do is waiting for upstream to fix it.

If it helps I'm running the patched kernel which solves the issue for #218 and using the above script I can't recreate this error, it seems to work perfectly. Looks like this is definitely a different form of the same issue.

phuhl commented

Thanks for confirming! I will close this for now, if somebody can reproduce w/o patch, feel free to reopen

I have found a possible workaround for people still using an affected kernel. The workaround consist on doing a export GHCRTS='-xp' before launching the process. I found it at message https://discourse.haskell.org/t/facing-mmap-4096-bytes-at-nil-cannot-allocate-memory-youre-not-alone/6259/3 when I was researching next issue with the latest compiled release the notification center (2.0.3):

user@pavonis[16]:~/TEMP> /usr/bin/deadd-notification-center
No existing translations for LC_CTYPE=es_ES.UTF-8;LC_NUMERIC=C.UTF-8;LC_TIME=es_ES.UTF-8;LC_COLLATE=es_ES.UTF-8;LC_MONETARY=C.UTF-8;LC_MESSAGES=C.UTF-8;LC_PAPER=C.UTF-8;LC_NAME=C.UTF-8;LC_ADDRESS=C.UTF-8;LC_TELEPHONE=C.UTF-8;LC_MEASUREMENT=C.UTF-8;LC_IDENTIFICATION=C.UTF-8.
Consider contributing your language.
https://github.com/phuhl/linux_notification_center/tree/master/translation
Trying English instead...

notificationDaemon started
deadd-notification-center: mmap 4096 bytes at (nil): Cannot allocate memory
deadd-notification-center: Try specifying an address with +RTS -xm<addr> -RTS
Segmentation fault

Luckily, both this issue and the crashes disappear with the workaround!