Bug 451939

Summary: Powerdevil crashes in QGuiApplicationPrivate::createPlatformIntegration() after re-login and Power Management applet does not appear in the System Tray
Product: [Plasma] Powerdevil Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: kde, liubomirwm, nate, nicolas.fella
Priority: NOR    
Version: 5.24.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=450320
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: journalctl log

Description Patrick Silva 2022-03-26 17:44:29 UTC
SUMMARY
Sometimes the Power Management applet does not appear in my system tray after re-login to Wayland session.
When this occurs, coredumpctl command reveals Power Devil crash.

STEPS TO REPRODUCE
1. login to Wayland session
2. logout
3. login to Wayland session again

OBSERVED RESULT
Power Management applet does not appear in system tray.

EXPECTED RESULT
Power Management applet always appears in system tray

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Graphics Platform: Wayland


Thread 1 (Thread 0x7f910324aa80 (LWP 49430)):
#0  0x00007f9108eef34c in __pthread_kill_implementation () from /usr/lib/libc.so.6
#1  0x00007f9108ea24b8 in raise () from /usr/lib/libc.so.6
#2  0x00007f9108e8c534 in abort () from /usr/lib/libc.so.6
#3  0x00007f910932fee4 in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1914
#4  QMessageLogger::fatal (this=this@entry=0x7ffdfa216700, msg=msg@entry=0x7f9109dd2029 "%s") at global/qlogging.cpp:893
#5  0x00007f910996ccc5 in init_platform (argv=<optimized out>, argc=@0x7ffdfa2166f0: -1685477552, platformThemeName=..., platformPluginPath=..., pluginNamesWithArguments=...) at kernel/qguiapplication.cpp:1254
#6  QGuiApplicationPrivate::createPlatformIntegration (this=0x55c49b8987a0) at kernel/qguiapplication.cpp:1481
#7  0x00007f910996d2e9 in QGuiApplicationPrivate::createEventDispatcher (this=<optimized out>) at kernel/qguiapplication.cpp:1498
#8  0x00007f910952208b in QCoreApplicationPrivate::init (this=this@entry=0x55c49b8987a0) at kernel/qcoreapplication.cpp:835
#9  0x00007f910996d3a7 in QGuiApplicationPrivate::init (this=0x55c49b8987a0) at kernel/qguiapplication.cpp:1527
#10 0x00007f910996e13c in QGuiApplication::QGuiApplication (this=<optimized out>, argc=<optimized out>, argv=<optimized out>, flags=<optimized out>, this=<optimized out>, argc=<optimized out>, argv=<optimized out>, flags=<optimized out>) at ../../include/QtGui/../../src/gui/kernel/qguiapplication.h:203
#11 0x000055c49addd0be in PowerDevilApp::PowerDevilApp (argv=0x7ffdfa216a90, argc=@0x7ffdfa2169ac: 1, this=0x7ffdfa216a10) at /usr/src/debug/powerdevil-5.24.3/daemon/powerdevilapp.cpp:48
#12 main (argc=<optimized out>, argv=0x7ffdfa216a90) at /usr/src/debug/powerdevil-5.24.3/daemon/powerdevilapp.cpp:155
Comment 1 Patrick Silva 2022-03-26 18:01:37 UTC
possibly bug 450320 is related
Comment 2 David Edmundson 2022-03-26 23:45:30 UTC
*** Bug 451941 has been marked as a duplicate of this bug. ***
Comment 3 David Edmundson 2022-03-26 23:48:01 UTC
>Sometimes the Power Management applet does not appear in my system tray after re-login to Wayland session.

That implies it tried to restart after a logout then failed to restart properly?
Can you confirm if you're using the systemd boot? Also any logs from the time.
Comment 4 Patrick Silva 2022-03-27 01:01:51 UTC
Created attachment 147755 [details]
journalctl log

I use systemd startup.
I'm attaching the journalctl log gotten after the following crashes that occured on login:

Sat 2022-03-26 21:49:57 -03   1090 1003 1003 SIGABRT present  /usr/bin/plasmashell                                                              
Sat 2022-03-26 21:49:57 -03   1093 1003 1003 SIGABRT present  /usr/lib/xdg-desktop-portal-kde                                                   
Sat 2022-03-26 21:49:56 -03   1165 1003 1003 SIGABRT present  /usr/lib/org_kde_powerdevil                                                       
Sat 2022-03-26 21:49:54 -03   1155 1003 1003 SIGABRT present  /usr/lib/org_kde_powerdevil                                                       
Sat 2022-03-26 21:49:54 -03   1148 1003 1003 SIGABRT present  /usr/lib/org_kde_powerdevil                                                       
Sat 2022-03-26 21:49:52 -03   1092 1003 1003 SIGABRT present  /usr/lib/org_kde_powerdevil
Comment 5 Bug Janitor Service 2022-04-11 04:35:00 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2022-04-26 04:35:23 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 7 Lyubomir 2022-04-29 15:27:48 UTC
Patrick, why is your bug NEEDSINFO / RESOLVED?
Comment 8 Nate Graham 2022-05-03 17:13:50 UTC
*** Bug 453125 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2022-05-03 17:16:10 UTC
Got another report; re-opening.
Comment 10 Lyubomir 2022-05-20 16:00:56 UTC
Not really sure what's happening on the system. I think this has happened today after just locking and unlocking, no logout. Not sure if all of these were due to unlocks/logins though.

...skipping...
Tue 2022-05-17 23:49:36 EEST  42243 1000 1001 SIGABRT present  /opt/visual-studio-code/code                                                          >
Tue 2022-05-17 23:50:10 EEST  42692 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Wed 2022-05-18 22:58:45 EEST  22136 1000 1001 SIGSEGV present  /opt/visual-studio-code/code                                                          >
Wed 2022-05-18 22:59:00 EEST  22062 1000 1001 SIGABRT present  /opt/visual-studio-code/code                                                          >
Wed 2022-05-18 22:59:41 EEST  22471 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Thu 2022-05-19 00:18:41 EEST  69412 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:18:41 EEST  69462 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:18:44 EEST  69436 1000 1001 SIGABRT present  /usr/lib/xdg-desktop-portal-kde                                                       >
Thu 2022-05-19 00:18:45 EEST  69409 1000 1001 SIGABRT present  /usr/bin/gmenudbusmenuproxy                                                           >
Thu 2022-05-19 00:18:45 EEST  69417 1000 1001 SIGABRT present  /usr/bin/plasmashell                                                                  >
Thu 2022-05-19 00:18:52 EEST  69478 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:18:53 EEST  69492 1000 1001 SIGABRT present  /usr/bin/gmenudbusmenuproxy                                                           >
Thu 2022-05-19 00:18:53 EEST  69493 1000 1001 SIGABRT present  /usr/bin/plasmashell                                                                  >
Thu 2022-05-19 00:18:55 EEST  69502 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:18:56 EEST  69515 1000 1001 SIGABRT present  /usr/bin/gmenudbusmenuproxy                                                           >
Thu 2022-05-19 00:18:56 EEST  69516 1000 1001 SIGABRT present  /usr/bin/plasmashell                                                                  >
Thu 2022-05-19 00:18:58 EEST  69525 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:18:58 EEST  69538 1000 1001 SIGABRT present  /usr/bin/gmenudbusmenuproxy                                                           >
Thu 2022-05-19 00:18:59 EEST  69539 1000 1001 SIGABRT present  /usr/bin/plasmashell                                                                  >
Thu 2022-05-19 00:19:00 EEST  69550 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Thu 2022-05-19 00:19:00 EEST  69561 1000 1001 SIGABRT present  /usr/bin/gmenudbusmenuproxy                                                           >
Thu 2022-05-19 00:19:01 EEST  69562 1000 1001 SIGABRT present  /usr/bin/plasmashell                                                                  >
Fri 2022-05-20 00:17:08 EEST 108310 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Fri 2022-05-20 00:30:13 EEST 110779 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Fri 2022-05-20 00:30:16 EEST 110791 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Fri 2022-05-20 00:30:18 EEST 110801 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Fri 2022-05-20 00:30:19 EEST 110811 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Fri 2022-05-20 00:30:24 EEST 110820 1000 1001 SIGABRT present  /usr/lib/org_kde_powerdevil                                                           >
Fri 2022-05-20 00:30:24 EEST 110834 1000 1001 SIGABRT present  /usr/lib/xdg-desktop-portal-kde                                                       >
Fri 2022-05-20 13:26:08 EEST 121492 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Fri 2022-05-20 13:27:54 EEST 121749 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Fri 2022-05-20 13:48:36 EEST 122965 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Fri 2022-05-20 13:51:05 EEST 123290 1000 1001 SIGABRT present  /usr/share/dotnet/dotnet                                                              >
Fri 2022-05-20 17:18:53 EEST 111026 1000 1001 SIGSEGV present  /usr/bin/kwin_wayland
Comment 11 Lyubomir 2022-05-20 16:04:29 UTC
Does using "terminate" in System Activity send SIGABRT? I sometimes use it explicitly to end /usr/bin/code, rzls (Razor language service) and dotnet maybe, but not powerdevil or xdg or whatever else.
Comment 12 Nicolas Fella 2022-07-27 20:46:52 UTC
(In reply to Patrick Silva from comment #4)
> Created attachment 147755 [details]
> journalctl log
> 
> I use systemd startup.
> I'm attaching the journalctl log gotten after the following crashes that
> occured on login:
> 
> Sat 2022-03-26 21:49:57 -03   1090 1003 1003 SIGABRT present 
> /usr/bin/plasmashell                                                        
> 
> Sat 2022-03-26 21:49:57 -03   1093 1003 1003 SIGABRT present 
> /usr/lib/xdg-desktop-portal-kde                                             
> 
> Sat 2022-03-26 21:49:56 -03   1165 1003 1003 SIGABRT present 
> /usr/lib/org_kde_powerdevil                                                 
> 
> Sat 2022-03-26 21:49:54 -03   1155 1003 1003 SIGABRT present 
> /usr/lib/org_kde_powerdevil                                                 
> 
> Sat 2022-03-26 21:49:54 -03   1148 1003 1003 SIGABRT present 
> /usr/lib/org_kde_powerdevil                                                 
> 
> Sat 2022-03-26 21:49:52 -03   1092 1003 1003 SIGABRT present 
> /usr/lib/org_kde_powerdevil

What I find suspicious here is a couple of

mar 26 21:49:45 Arch-PC org_kde_powerdevil[1165]: qt.qpa.xcb: could not connect to display
mar 26 21:49:45 Arch-PC org_kde_powerdevil[1165]: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
mar 26 21:49:45 Arch-PC org_kde_powerdevil[1165]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

It should not try to connect to X11 in a Wayland session. That suggests there might be something wrong with the platform detection. Or Patrick was actually logging into X11...
Comment 13 Nicolas Fella 2022-07-27 20:48:07 UTC
Worth noting is that both powerdevil and plasma use KWorkSpace::detectPlatform, which does X11/Wayland detection things. Perhaps that is related
Comment 14 Nicolas Fella 2022-07-27 21:08:36 UTC
hmm, I'm also seeing this kind of crash with kwallet which doesn't do that

Jul 27 22:53:52 madeye kwalletd5[393471]: qt.qpa.wayland: Creating a fake screen in order for Qt not to crash
Jul 27 22:53:52 madeye kwalletd5[393471]: The Wayland connection broke. Did the Wayland compositor die?
Jul 27 22:53:59 madeye kwalletd5[394567]: qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
Jul 27 22:53:59 madeye kwalletd5[394567]: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
Jul 27 22:53:59 madeye audit[394567]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=10 subj=kernel pid=394567 comm="kwalletd5" exe="/usr/bin/kwalletd5" sig=6 res=1
Jul 27 22:53:59 madeye kwalletd5[394567]: 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, webgl, xcb.
Comment 15 David Edmundson 2023-09-29 14:31:48 UTC
Git commit 6ce8f434139f47e6a71bf0b68beae92be8845ce4 by David Edmundson.
Committed on 29/09/2023 at 16:31.
Pushed by davidedmundson into branch 'master'.

Use systemd to handle more of the shutdown

Previously we killed kwin manually, then tried to exit the session.
This is racey as kwin will close all connections, before systemd has
realised that the session is ending this can cause all apps to restart.

Also closing plasma-workspace-wayland.target is ineffective, closing the
graphical-session implicitly brings down the session more explicitly.
It'll close the other targets and services.
Related: bug 473824, bug 409088, bug 450531, bug 450320, bug 434403

Tested by looking at `coredumpctl list` after a logout and seeing it go from 10 entries of silly aborts restarting without a display server to 3, with different unrelated causes.

M  +12   -4    startkde/plasma-shutdown/shutdown.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/6ce8f434139f47e6a71bf0b68beae92be8845ce4