Bug 473392 - segfault after suspend-resume on wayland
Summary: segfault after suspend-resume on wayland
Status: CLOSED DOWNSTREAM
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.27.7
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-15 03:02 UTC by kndevl
Modified: 2023-08-21 19:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kndevl 2023-08-15 03:02:10 UTC
SUMMARY

Unfortunately, I do not have debug symbols for /usr/lib/org_kde_powerdevil. This binary is built from the AUR package powerdevil-ddcutil https://web.archive.org/web/20230317190426/https://aur.archlinux.org/packages/powerdevil-ddcutil

Thread 2 (Thread 0x7f33d1d826c0 (LWP 60084)):
#0  0x00007f33d7b039df in poll () at /usr/lib/libc.so.6
#1  0x00007f33d716cc2f in  () at /usr/lib/libglib-2.0.so.0
#2  0x00007f33d710d0e2 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#3  0x00007f33d84eb51c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#4  0x00007f33d849b404 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#5  0x00007f33d82f73b6 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#6  0x00007f33d8f54a9a in  () at /usr/lib/libQt5DBus.so.5
#7  0x00007f33d82f35da in  () at /usr/lib/libQt5Core.so.5
#8  0x00007f33d7a8c9eb in  () at /usr/lib/libc.so.6
#9  0x00007f33d7b1123c in  () at /usr/lib/libc.so.6

Thread 1 (Thread 0x7f33d289d8c0 (LWP 60083)):
#0  0x00007f33d7a8e83c in  () at /usr/lib/libc.so.6
#1  0x00007f33d7a3e668 in raise () at /usr/lib/libc.so.6
#2  0x00007f33d7a264b8 in abort () at /usr/lib/libc.so.6
#3  0x00007f33d82a0098 in qt_assert(char const*, char const*, int) () at /usr/lib/libQt5Core.so.5
#4  0x00007f33d893f3f2 in QGuiApplicationPrivate::createPlatformIntegration() () at /usr/lib/libQt5Gui.so.5
#5  0x00007f33d893fa69 in QGuiApplicationPrivate::createEventDispatcher() () at /usr/lib/libQt5Gui.so.5
#6  0x00007f33d849c195 in QCoreApplicationPrivate::init() () at /usr/lib/libQt5Core.so.5
#7  0x00007f33d893fb16 in QGuiApplicationPrivate::init() () at /usr/lib/libQt5Gui.so.5
#8  0x00007f33d894084c in QGuiApplication::QGuiApplication(int&, char**, int) () at /usr/lib/libQt5Gui.so.5
#9  0x0000562f7d6430a5 in  ()
#10 0x00007f33d7a27cd0 in  () at /usr/lib/libc.so.6
#11 0x00007f33d7a27d8a in __libc_start_main () at /usr/lib/libc.so.6
#12 0x0000562f7d643255 in  ()

STEPS TO REPRODUCE
1. Suspend and resume 

OBSERVED RESULT
The entirety of plasmashell glitches and flashes violently. I am creating bug reports for the things I see in journalctl.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: ArchLinux/5.27.7
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel: 6.1.44-1-lts (64-bit)

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-08-17 18:09:29 UTC
You can use debuginfo to get debug symbols for powerdevil. Please do so and then attach a backtrace that shows the crashing thread.
Comment 2 kndevl 2023-08-17 22:08:41 UTC
The backtrace was sloppy the first time because I had built the package from AUR with `!debug` and `strip` enabled by default. I updated it to the latest powerdevil and built it with debug symbols this time. systemd-coredumpd does not seem to catch the backtrace again, but I'll give it another shot.

I simplified the crash to a much simpler case. powerdevil crashes and aborts on logging out. Here's the rough timeline. Logs attached at the end.

1. Cold boot
2. Log in: SDDM is still on X11 because wayland does not work for me
3. Log out: no errors related to powerdevil until this point

org_kde_powerdevil[1136]: The Wayland connection broke. Did the Wayland compositor die?
systemd[890]: Starting Powerdevil...
systemd[890]: plasma-powerdevil.service: Scheduled restart job, restart counter is at 1.
org_kde_powerdevil[1596]: Failed to create wl_display (No such file or directory)
org_kde_powerdevil[1596]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
org_kde_powerdevil[1596]: qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
systemd[890]: Failed to start Powerdevil.
systemd[890]: plasma-powerdevil.service: Failed with result 'core-dump'.
systemd[890]: plasma-powerdevil.service: Main process exited, code=dumped, status=6/ABRT

Note: A lot of other kde services such as kdeconnectd, krunner, kactivitymanagerd, plasmashell, kwalletd5, kded5 die with similar error message. plasmashell produces a core dump when systemd tries to restart it: `plasma-plasmashell.service: Scheduled restart job, restart counter is at 1.`

To summarize, can we reduce the scope of this bug to finding the reason why services automatically start after a logout?
Comment 3 kndevl 2023-08-17 22:13:09 UTC
https://bbs.archlinux.org/viewtopic.php?id=263885 appears related

> This is what journalctl reports (option -p 3) about the time of the attempted logout. <snip>
> Lots of KDE related task notifying the end of the Wayland connection, some several times
> and lots of coredumps of KDE related tasks ...
Comment 4 kndevl 2023-08-17 22:22:55 UTC
The full backtrace using debuginfod. `bt full` did not add anything useful so I am posting the short version `bt`

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fa4cf28e8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fa4cf23e668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fa4cf2264b8 in __GI_abort () at abort.c:79
#4  0x00007fa4cfaa0098 in qt_message_fatal (message=<synthetic pointer>..., context=<optimized out>) at global/qlogging.cpp:1919
#5  QMessageLogger::fatal(char const*, ...) const (this=this@entry=0x7ffecd96d6c0, msg=msg@entry=0x7fa4d05737de "%s") at global/qlogging.cpp:898
#6  0x00007fa4d013f3f2 in init_platform (argv=<optimized out>, argc=@0x7ffecd96d90c: 1, platformThemeName=..., platformPluginPath=..., pluginNamesWithArguments=...) at kernel/qguiapplication.cpp:1254
#7  QGuiApplicationPrivate::createPlatformIntegration() (this=0x5588235f0b90) at kernel/qguiapplication.cpp:1484
#8  0x00007fa4d013fa69 in QGuiApplicationPrivate::createEventDispatcher() (this=<optimized out>) at kernel/qguiapplication.cpp:1501
#9  0x00007fa4cfc9c195 in QCoreApplicationPrivate::init() (this=this@entry=0x5588235f0b90) at kernel/qcoreapplication.cpp:835
#10 0x00007fa4d013fb16 in QGuiApplicationPrivate::init() (this=0x5588235f0b90) at kernel/qguiapplication.cpp:1530
#11 0x00007fa4d014084c in QGuiApplication::QGuiApplication(int&, char**, int) (this=this@entry=0x7ffecd96d940, argc=@0x7ffecd96d90c: 1, argv=0x7ffecd96dac8, flags=flags@entry=331530, this=<optimized out>, argc=<optimized out>, argv=<optimized out>, flags=<optimized out>)
    at ../../include/QtGui/../../src/gui/kernel/qguiapplication.h:203
#12 0x0000558821d420a5 in PowerDevilApp::PowerDevilApp(int&, char**) (argv=<optimized out>, argc=@0x7ffecd96d90c: 1, this=0x7ffecd96d940) at /usr/src/debug/powerdevil-ddcutil/powerdevil-5.27.7/daemon/powerdevilapp.cpp:48
#13 main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/powerdevil-ddcutil/powerdevil-5.27.7/daemon/powerdevilapp.cpp:155
Comment 5 Nate Graham 2023-08-21 17:48:14 UTC
> #6  0x00007fa4d013f3f2 in init_platform (argv=<optimized out>, argc=@0x7ffecd96d90c: 1, platformThemeName=..., platformPluginPath=..., pluginNamesWithArguments=...) at kernel/qguiapplication.cpp:1254
> #7  QGuiApplicationPrivate::createPlatformIntegration() (this=0x5588235f0b90) at kernel/qguiapplication.cpp:1484

This means there is some kind of subtle misconfiguration on your system. Given that you're using an AUR package, I suspect it's not built correctly. The next step would be to report this to the author of that package.
Comment 6 kndevl 2023-08-21 18:00:42 UTC
> This means there is some kind of subtle misconfiguration on your system. Given that you're using an AUR package, I suspect it's not built correctly. The next step would be to report this to the author of that package.

I agree that this is a misconfiguration somewhere, as indicated by the journal as well - "org_kde_powerdevil[1136]: The Wayland connection broke. Did the Wayland compositor die?". In my understanding, plasma uses systemd user units to start powerdevil. When I log out, plasma does not "tell" systemd that powerdevil need not be restarted?

There is nothing noteworthy in my PKGBUILD: `cmake -B build -S $_pkgname-$pkgver -DCMAKE_INSTALL_LIBEXECDIR=lib -DBUILD_TESTING=OFF -DHAVE_DDCUTIL=On`. Upstream does not package ddcutil but I require it. That's why I use the AUR package. I now see DDCUTIL is turned on in the upstream package as well, so I am going to try it next.
Comment 7 Nate Graham 2023-08-21 18:14:16 UTC
We can't offer more support for this issue, sorry.
Comment 8 kndevl 2023-08-21 18:19:25 UTC
That's okay, I understand. Since the systemd unit files are provided by KDE and not arch, where do you suggest I open another issue about plasma's interaction with systemd? The file in question `plasma-powerdevil.service` is indeed owned by powerdevil: https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/plasma-powerdevil.service.in; If this service does not terminate properly when wayland dies, then would you consider it a bug in powerdevil?
Comment 9 Nate Graham 2023-08-21 18:39:23 UTC
So on Wayland, it's currently expected that when the compositor dies and the wayland socket is severed, everything dies. So Powerdevil is not unique there. Not ideal, but not worse than anything else.

In Plasma 6 with Qt 6.6 however, it's another story: all Qt-based software should survive and not die or crash. Very cool.

So if you're using 5.27.7, I'd say the dies-when-the-compositor-crashes behavior you're seeing is expected, so there's no need for a bug report. If you still see it happening in Plasma 6 with Qt 6.6 though, that wold be worth a bug report.
Comment 10 kndevl 2023-08-21 18:40:51 UTC
Got it. Thank you for the explanation! Looking forward to plasma 6 :)
Comment 11 Nate Graham 2023-08-21 19:00:45 UTC
You're welcome!