Bug 411399 - KDEConnect slow when bluetooth service is not started
Summary: KDEConnect slow when bluetooth service is not started
Status: REPORTED
Alias: None
Product: kdeconnect
Classification: Applications
Component: plasmoid (show other bugs)
Version: 1.3.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-28 20:32 UTC by Wouter Haffmans
Modified: 2020-05-28 22:02 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 Wouter Haffmans 2019-08-28 20:32:07 UTC
SUMMARY
On Arch Linux with Bluez installed but no Bluetooth device plugged in, the KDE Connect applet seems to slow down the starting up of Plasma.

After plugging in a (USB) Bluetooth adapter, Plasma starts up quickly again.

STEPS TO REPRODUCE
1. Install Bluez, bluedevil, Plasma and KDE Connect
2. Unplug any Bluetooth adapters (such that /sys/class/bluetooth no longer exists), or modify the dbus-org.bluez.service (bluetooth.service) file to have a startup condition that's always false.
3. Login to Plasma

OBSERVED RESULT
Plasma takes a long time to start up. Relevant log lines from journalctl:

aug 28 21:36:15 mortimer dbus-daemon[941]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.1266' (uid=1000 pid=8188 comm="/usr/lib/kdeconnectd ")
aug 28 21:36:15 mortimer systemd[1]: Condition check resulted in Bluetooth service being skipped.
-- Subject: A start job for unit bluetooth.service has finished successfully
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit bluetooth.service has finished successfully.
-- 
-- The job identifier is 2878.
aug 28 21:36:15 mortimer klauncher[8427]: Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
<snip>
aug 28 21:36:17 mortimer kdeinit5[8430]: Installing the delayed initialization callback.
aug 28 21:36:17 mortimer kdeinit5[8430]: org.kde.bluez: Cannot open /dev/rfkill for reading!
aug 28 21:36:17 mortimer kdeinit5[8430]: bluedevil: Created
aug 28 21:36:17 mortimer kdeinit5[8430]: Delayed initialization.
aug 28 21:36:17 mortimer kdeinit5[8430]: Reloading the khotkeys configuration
aug 28 21:36:17 mortimer kdeinit5[8430]: Version 2 File!
aug 28 21:36:17 mortimer kdeinit5[8430]: true
aug 28 21:36:17 mortimer kdeinit5[8430]: Imported file "/usr/share/khotkeys/defaults.khotkeys"
aug 28 21:36:17 mortimer kdeinit5[8430]: Imported file "/usr/share/khotkeys/konqueror_gestures_kde321.khotkeys"
aug 28 21:36:17 mortimer kdeinit5[8430]: Imported file "/usr/share/khotkeys/konsole.khotkeys"
aug 28 21:36:17 mortimer kdeinit5[8430]: Imported file "/usr/share/khotkeys/kde32b1.khotkeys"
aug 28 21:36:17 mortimer kdeinit5[8430]: bluedevil: Bluetooth operational changed false
aug 28 21:36:17 mortimer kdeinit5[8430]: bluedevil: ObexManager operational changed true
aug 28 21:36:17 mortimer kdeinit5[8430]: bluedevil: ObexAgent registered
<snip>
aug 28 21:36:40 mortimer dbus-daemon[941]: [system] Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)
aug 28 21:36:40 mortimer pulseaudio[8974]: E: [pulseaudio] bluez5-util.c: GetManagedObjects() failed: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)
aug 28 21:36:40 mortimer kdeconnectd[8188]: Cannot find a running Bluez. Please check the Bluez installation.
aug 28 21:36:40 mortimer kdeinit5[8430]: org.kde.bluez: PendingCall Error: "Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)"
aug 28 21:36:40 mortimer kdeconnectd[8188]: kdeconnect.core: onStart
aug 28 21:36:40 mortimer dbus-daemon[941]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.1266' (uid=1000 pid=8188 comm="/usr/lib/kdeconnectd ")
aug 28 21:36:40 mortimer systemd[1]: Condition check resulted in Bluetooth service being skipped.
-- Subject: A start job for unit bluetooth.service has finished successfully
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit bluetooth.service has finished successfully.
-- 
-- The job identifier is 2987.
aug 28 21:36:42 mortimer plasmashell[8478]: error activating kdeconnectd: QDBusError("", "")
<snip>
aug 28 21:37:05 mortimer dbus-daemon[941]: [system] Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)
aug 28 21:37:05 mortimer dbus-daemon[1725]: [session uid=1000 pid=1725] Successfully activated service 'org.kde.kdeconnect'
aug 28 21:37:05 mortimer kdeconnectd[8188]: kdeconnect.core: No local bluetooth adapter found
aug 28 21:37:05 mortimer kdeconnectd[8188]: kdeconnect.core: KdeConnect daemon started
aug 28 21:37:05 mortimer plasmashell[8478]: kdeconnect.interfaces: dbus interface not valid
aug 28 21:37:05 mortimer plasmashell[8478]: kdeconnect.interfaces: dbus interface not valid
aug 28 21:37:05 mortimer kdeconnectd[8188]: kdeconnect.core: Broadcasting identity packet


EXPECTED RESULT

The condition in /usr/lib/systemd/system/bluetooth.service (with Alias=dbus-org.bluez.service; owned by package bluez) is "ConditionPathIsDirectory=/sys/class/bluetooth". This condition is not met. I'd expect kdeconnect to immediately discover that it will not attempt to start the Bluez daemon and should not timeout waiting for the service to come up (especially not repeatedly, which seems to be happening).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux (rolling)
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.0

ADDITIONAL INFORMATION
Systemd: 242.84-2
Bluez: 5.50-6

The problem started with a recent update: either KDE Frameworks (5.60.0 to 5.61.0) or KDE applications (19.04.3 to 19.08.0). Kde Connect wasn't upgraded to a new version, but it was repackaged by Arch Linux.

It seems similar timeout behavior happens to pulseaudio (judging from the logs, that too wants to start Bluez), but it doesn't seem to cause such a severe startup delay as KDE Connect - but I might be wrong.

My apologies if this bug is filed to the wrong project - this simply seemed to be the most likely cause of the slow startup, judging from the logs.
Comment 1 Yaroslav Sidlovsky 2020-05-28 22:02:59 UTC
Could be related: https://bugs.kde.org/show_bug.cgi?id=401088.

When I start KDEConnect built with Bluetooth support in the test VM without Bluetooth adapter attached - I see messages like in bug #401088.