Bug 434290 - After re-login, sometimes kdeinit5 takes 30 seconds to start
Summary: After re-login, sometimes kdeinit5 takes 30 seconds to start
Status: RESOLVED UNMAINTAINED
Alias: None
Product: frameworks-kinit
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.83.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: wayland
: 439606 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-11 16:06 UTC by Patrick Silva
Modified: 2023-07-03 21:10 UTC (History)
18 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Output from ps from other user (2.44 KB, text/plain)
2021-05-30 15:39 UTC, Larry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2021-03-11 16:06:13 UTC
SUMMARY
Sometimes re-login takes almost 2 minutes on my system and then apps like Kate, Dolphin and
Gwenview takes 30 seconds to open in the just started Plasma session. When I open these apps via Konsole, I see this error message:

"kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to start."

I'm not sure if this is related, but systemd startup is enabled on my system.

STEPS TO REPRODUCE
1. boot your machine
2. start Wayland session
3. logout
4. immediately start Wayland session again. 
5. open Kate, Dolphin or Gwenview

OBSERVED RESULT
App used in the step 5 takes 30 seconds to open.
If the delay did not occur, repeat the steps 3, 4 and 5 above.
At some point apps will take 30 seconds to open.

EXPECTED RESULT
no delay to open apps

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Graphics Platform: Wayland

ADDITIONAL INFORMATION
bug 434286 is another problem after re-login. Possibly related.
Comment 1 Nate Graham 2021-03-11 19:23:22 UTC
I experienced this the other day. Rebooting fixed it.
Comment 2 Nate Graham 2021-03-11 22:21:05 UTC
(also using systemd startup, and also it happened on the second login)
Comment 3 Real Name 2021-04-02 02:58:31 UTC
Seems like kdeinit5 cannot kill itself when you close a Wayland session (doesn't happen under X11). If you log into a VT and "pgrep -U $USER kdeinit5 -a" you'll see some "kdeinit5 --suicide" processes stuck, along with a rogue "/usr/libexec/startplasma-waylandsession". Killing those processes manually and logging in again solves the problem, or you can make systemd kill all of your processes when your session ends.

OS: Fedora 34 beta
Plasma version: 5.21.3
Frameworks version: 5.80.0
Qt version: 5.15.2
Comment 4 Méven Car 2021-04-02 03:52:30 UTC
FI kdeinit is being deprecated and should be removed for KF6.
Comment 5 Patrick Silva 2021-05-14 14:53:26 UTC
Still an issue on Plasma 5.22 beta.

Operating System: Arch Linux
KDE Plasma Version: 5.21.90
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 6 Larry 2021-05-29 20:33:04 UTC
Fresh install of Fedora 34 KDE Spin, 16 GB RAM, 16 GB swap, Intel i7-9700 @ 3 GHz, dual Samsung SSD 860 EVO 2TB disk drives and KDE apps randomly don't load or load with a 30-second delay.  It is incredibly frustrating and may be the reason I give up on KDE after 15 years of support.  Is there at lest a workaround?
Comment 7 Larry 2021-05-30 12:41:01 UTC
Output from "journalctl -f":
May 30 08:28:20 k34 plasmashell[254932]: kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x55afacd0b460)
May 30 08:28:20 k34 plasmashell[254932]: kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x55afacd0b460)
May 30 08:28:20 k34 plasmashell[254932]: kf.plasma.quick: Couldn't create KWindowShadow for ToolTipDialog(0x55afacd0b460)
  -- Entries logged when I clicked the app menu button:
May 30 08:28:21 k34 systemd[3914]: Started Kate - Advanced Text Editor.
May 30 08:28:21 k34 kate[256947]: qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
May 30 08:28:51 k34 kate[256947]: kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to start.
Kate window appeared afterwards.

Another test with Dolphin:
May 30 08:37:50 k34 systemd[3914]: Started Dolphin - File Manager.
May 30 08:38:21 k34 dolphin[260061]: kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to start.
May 30 08:38:22 k34 systemd[3914]: app-org.kde.dolphin-44bcfa2fe6ca4b57afe83f5505a9b79b.scope: Deactivated successfully.
Dolphin window appeared afterwards.
 
~/.cache/wayland-errors contains the following for every mouse-click in the App menu:
This plugin does not support raise()

The following line appears once or twice in ~/.cache/wayland-errors when launching apps:
kwin_libinput: Libinput: event4  - ATEN Advance Tech Inc. HDMI KVM V1.0.071: client bug: event processing lagging behind by 22ms, your system is too slow
Comment 8 Larry 2021-05-30 13:22:24 UTC
Launching Discover:
May 30 09:03:38 k34 systemd[3914]: Started Discover - Software Center.
May 30 09:03:38 k34 plasma-discover[267935]: QObject::startTimer: Timers cannot have negative intervals
May 30 09:03:39 k34 plasma-discover[267935]: kf.newstuff.core: The CustomName property is deprecated and will be removed in KF6
May 30 09:03:39 k34 plasma-discover[267935]: kf.newstuff.core: The ChecksumPolicy feature is defunct
May 30 09:03:39 k34 plasma-discover[267935]: kf.newstuff.core: The SignaturePolicy feature is defunct
May 30 09:03:39 k34 plasma-discover[267935]: kf.newstuff.core: The ChecksumPolicy feature is defunct
May 30 09:03:39 k34 plasma-discover[267935]: kf.newstuff.core: The SignaturePolicy feature is defunct
May 30 09:03:39 k34 plasma-discover[267935]: invalid kns backend! "/usr/share/knsrcfiles/servicemenu.knsrc" because: "Config group not found! Check your KNS3 installation."
May 30 09:03:39 k34 plasma-discover[267935]: adding empty sources model QStandardItemModel(0x56496bf33be0)
May 30 09:04:09 k34 plasma-discover[267935]: kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to start.
May 30 09:04:09 k34 plasma-discover[267935]: org.kde.plasma.libdiscover: Couldn't find a category for  "fwupd-backend"
May 30 09:04:09 k34 plasma-discover[267935]: file:///usr/lib64/qt5/qml/org/kde/kirigami.2/private/PrivateActionToolButton.qml:74:5: QML Binding: Binding loop detected for property "value"
Discover appeared with message "Unable to load applications. Please verify Internet connectivity.".

Settings launches properly though it was problematic yesterday.
Comment 9 Larry 2021-05-30 15:39:53 UTC
Created attachment 138882 [details]
Output from ps  from other user

Logged off as Larry and on as different user.  30-second delay occurring.  Output from ps attached.
Comment 10 Matt Fagnani 2021-07-23 03:10:48 UTC
When I've logged out of Plasma 5.22.3 with KF 5.83.0 and Qt 5.15.2 and earlier on Wayland in a Fedora 34 KDE Plasma installation then logged in again, Plasma was delayed by 30 seconds when starting remaining on the splash screen for that long. The desktop icons took another 30 seconds to appear. Certain KDE programs such as Dolphin and Gwenview took 30 seconds to start. The file selection dialogs in Qt-based programs like VLC took 30 seconds to start. The most relevant messages in the journal when this delay happened were like
kded5[9321]: kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to start.
The journal when logging in to Plasma on Wayland was delayed after logging out as the same user is attached at https://bugzilla.redhat.com/show_bug.cgi?id=1985151

I first noticed this problem when logging out from Plasma on Wayland as one user then logging into Plasma on Wayland as a second user. This problem happened most of the time when doing so over the last few weeks at least. I had set KillUserProcesses=yes in /etc/systemd/logind.conf to stop the user session processes during that time. I changed that to #KillUserProcesses=yes in /etc/systemd/logind.conf. After that change, Plasma and other programs were delayed by 30 seconds when I logged out as one user and logged in again as the same user. These observations led me to think that some processes or files were left over after ending the first Plasma session which might be kdeinit5_shutdown and /tmp/startkdeinitlock as I describe below.

A similar report about Dolphin taking 30 s to start noted that /tmp/startkdeinitlock was left after logging out as userA and logging in as userB at https://bugs.kde.org/show_bug.cgi?id=439606 I noticed that /tmp/startkdeinitlock was present when the Plasma startup delay happened, but not otherwise. /tmp/startkdeinitlock was a text file containing
9014
kdeinit5_shutdown
localhost.localdomain
<Machine ID>
<UUID>

The kdeinit5_shutdown process was running when the problem happened, but it wasn't running when the problem wasn't happening. kdeinit5_shutdown and /tmp/startkdeinitlock seemed to be left over from the first Plasma session, and they might be blocking Plasma and other programs from starting normally. I tried removing /tmp/startkdeinitlock and stopping kdeinit5_shutdown, and the problem seemed to go away at least for starting Dolphin and loading the desktop icons during the same session.
Comment 11 Alexander 2021-07-25 11:02:35 UTC
*** Bug 439606 has been marked as a duplicate of this bug. ***
Comment 12 Méven Car 2021-08-14 18:54:43 UTC
(In reply to Matt Fagnani from comment #10)
> When I've logged out of Plasma 5.22.3 with KF 5.83.0 and Qt 5.15.2 and
> earlier on Wayland in a Fedora 34 KDE Plasma installation then logged in
> again, Plasma was delayed by 30 seconds when starting remaining on the
> splash screen for that long. The desktop icons took another 30 seconds to
> appear. Certain KDE programs such as Dolphin and Gwenview took 30 seconds to
> start. The file selection dialogs in Qt-based programs like VLC took 30
> seconds to start. The most relevant messages in the journal when this delay
> happened were like
> kded5[9321]: kf.dbusaddons: 'kdeinit5' is taking more than 30 seconds to
> start.
> The journal when logging in to Plasma on Wayland was delayed after logging
> out as the same user is attached at
> https://bugzilla.redhat.com/show_bug.cgi?id=1985151
> 
> I first noticed this problem when logging out from Plasma on Wayland as one
> user then logging into Plasma on Wayland as a second user. This problem
> happened most of the time when doing so over the last few weeks at least. I
> had set KillUserProcesses=yes in /etc/systemd/logind.conf to stop the user
> session processes during that time. I changed that to #KillUserProcesses=yes
> in /etc/systemd/logind.conf. After that change, Plasma and other programs
> were delayed by 30 seconds when I logged out as one user and logged in again
> as the same user. These observations led me to think that some processes or
> files were left over after ending the first Plasma session which might be
> kdeinit5_shutdown and /tmp/startkdeinitlock as I describe below.
> 
> A similar report about Dolphin taking 30 s to start noted that
> /tmp/startkdeinitlock was left after logging out as userA and logging in as
> userB at https://bugs.kde.org/show_bug.cgi?id=439606 I noticed that
> /tmp/startkdeinitlock was present when the Plasma startup delay happened,
> but not otherwise. /tmp/startkdeinitlock was a text file containing
> 9014
> kdeinit5_shutdown
> localhost.localdomain
> <Machine ID>
> <UUID>
> 
> The kdeinit5_shutdown process was running when the problem happened, but it
> wasn't running when the problem wasn't happening. kdeinit5_shutdown and
> /tmp/startkdeinitlock seemed to be left over from the first Plasma session,
> and they might be blocking Plasma and other programs from starting normally.
> I tried removing /tmp/startkdeinitlock and stopping kdeinit5_shutdown, and
> the problem seemed to go away at least for starting Dolphin and loading the
> desktop icons during the same session.

That is some nice investigating.

Looking at kdeinit5_shutdown code 

        header.cmd = LAUNCHER_TERMINATE_KDE;
        header.arg_length = 0;
        write_socket(sock, (char *) &header, sizeof(header));
        read_socket(sock, (char *) &header, 1); /* wait for the socket to close */

It seems stuck either writing or reading to the kdeinit socket.
I am guessing something else is keeping kdeinit5_shutdown from terminating because of this socket.
Comment 13 Christoph Cullmann 2023-07-03 21:10:22 UTC
kinit is removed for the upcoming kf6, beside critical fixes nothing will be done in the kf5 branch.