Bug 503431 - Bluetooth backend of kdeconnect may cause plasma or kdeconnect-app to freeze for 25 seconds
Summary: Bluetooth backend of kdeconnect may cause plasma or kdeconnect-app to freeze ...
Status: RESOLVED WORKSFORME
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (other bugs)
Version First Reported In: 25.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Rob Emery
URL:
Keywords:
: 504690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-04-27 11:47 UTC by otiskujawa
Modified: 2025-06-27 18:06 UTC (History)
4 users (show)

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


Attachments
Video of kdeconnect-app not responding (2.74 MB, video/mp4)
2025-04-27 11:47 UTC, otiskujawa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description otiskujawa 2025-04-27 11:47:47 UTC
Created attachment 180705 [details]
Video of kdeconnect-app not responding

# SUMMARY
Around a minute after starting system, entire plasmashell freezes (all plasmoids, panels etc.) for around 25 seconds.
It happens only when kdeconnect is enabled with bluetooth backend.
My system does not have bluetooth capabilities.
If i open kdeconnect-app, enable bluetooth in settings and then try to access device it causes app to not respond for similar amount of time.

# STEPS TO REPRODUCE

## kdeconnect-app issue
1. open kdeconnect-app
2. go to settings
3. re/enable bluetooth
4. try to access device page

OBSERVED RESULT
As seen in attached video, application is not responding for about 20 seconds.

EXPECTED RESULT
App should open device page immediately just as when skipping 3rd step.

## plasma issue
1. open kdeconnect-app
2. go to settings
3. enable bluetooth
4. reboot computer
5. log into plasma
6. wait for about a minute

OBSERVED RESULT
plasmashell and all plasmoids freeze for around 20 seconds.
If during that time any icon was clicked, it executes that action after freeze ends.
It happens only while bluetooth backend is enabled

EXPECTED RESULT
Everything works and should be responsive.

SOFTWARE/OS VERSIONS
Linux: 6.14.3-arch1-1 (64-bit)
KDE Plasma: X11
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0
Has been happening since around plasma 6.

ADDITIONAL INFORMATION
I couldn't find any additional information since app is not crashing but i found this appearing in journal of plasmashell:

Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Apr 27 13:03:50 raphael plasmashell[1140]: kdeconnect.interfaces: error while refreshing device list "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."

Those errors appear only with the issue with plasmashell when bluetooth backend is enabled on startup
Comment 1 Rob Emery 2025-05-04 15:05:41 UTC
Just looking into this, if you look at:
`journalctl --user -u app-org.kde.kdeconnect.daemon@autostart.service` do you see the "kdeconnect.core: No local bluetooth adapter found" warning when you enable bluetooth in the settings or is that log absent?
Comment 2 Rob Emery 2025-05-04 19:12:28 UTC
Just tried to reproduce this and I can't get it to hang like you're seeing. Using arch, KDEConect 24.04.0 all freshly installed. 

I'm wondering if you have some bluetooth stack installed but no hardware and that behaves differently to what I have here (no bluetooth stack installed and no hardware either). 

Does this output match for you:
```
[rob@ISIS-arch kdeconnect]$ pacman -Q | grep -i blue
bluez-libs 5.82-1
```

or do you have additional bluetooth packages on?
Comment 3 otiskujawa 2025-05-05 20:10:53 UTC
(In reply to Rob Emery from comment #1)
> Just looking into this, if you look at:
> `journalctl --user -u app-org.kde.kdeconnect.daemon@autostart.service` do
> you see the "kdeconnect.core: No local bluetooth adapter found" warning when
> you enable bluetooth in the settings or is that log absent?

There are logs from day i tested it multiple times
-- Boot cbd8c7aa99bc477e9b3d6484abb4fa3a --
Apr 26 11:31:17 raphael systemd[1025]: Starting KDE Connect...
Apr 26 11:31:17 raphael systemd[1025]: Started KDE Connect.
Apr 26 11:31:59 raphael kdeconnectd[2213]: QThreadStorage: entry 8 destroyed before end of thread 0x5c982ce67860
Apr 26 11:31:59 raphael kdeconnectd[2213]: QThreadStorage: entry 3 destroyed before end of thread 0x5c982ce67860
Apr 26 11:31:59 raphael kdeconnectd[2213]: QThreadStorage: entry 2 destroyed before end of thread 0x5c982ce67860
-- Boot 6c8b79919998461ebdd333deb5d4f14f --
Apr 27 02:29:02 raphael systemd[1017]: Starting KDE Connect...
Apr 27 02:29:02 raphael systemd[1017]: Started KDE Connect.
Apr 27 02:29:46 raphael kdeconnectd[2183]: QThreadStorage: entry 8 destroyed before end of thread 0x598a1ecd9860
Apr 27 02:29:46 raphael kdeconnectd[2183]: QThreadStorage: entry 3 destroyed before end of thread 0x598a1ecd9860
Apr 27 02:29:46 raphael kdeconnectd[2183]: QThreadStorage: entry 2 destroyed before end of thread 0x598a1ecd9860
-- Boot 37da10e7ee7642859d1e41b8bd158cf3 --
Apr 27 12:24:43 raphael systemd[1020]: Starting KDE Connect...
Apr 27 12:24:43 raphael systemd[1020]: Started KDE Connect.
Apr 27 12:25:26 raphael kdeconnectd[2207]: QThreadStorage: entry 8 destroyed before end of thread 0x55ceaead1860
Apr 27 12:25:26 raphael kdeconnectd[2207]: QThreadStorage: entry 3 destroyed before end of thread 0x55ceaead1860
Apr 27 12:25:26 raphael kdeconnectd[2207]: QThreadStorage: entry 2 destroyed before end of thread 0x55ceaead1860
-- Boot 5ccee2c86429429b8ffd60a9e17e99a7 --
Apr 27 12:47:17 raphael systemd[1022]: Starting KDE Connect...
Apr 27 12:47:17 raphael systemd[1022]: Started KDE Connect.
Apr 27 12:47:36 raphael kdeconnectd[2183]: QThreadStorage: entry 8 destroyed before end of thread 0x590f0772e860
Apr 27 12:47:36 raphael kdeconnectd[2183]: QThreadStorage: entry 3 destroyed before end of thread 0x590f0772e860
Apr 27 12:47:36 raphael kdeconnectd[2183]: QThreadStorage: entry 2 destroyed before end of thread 0x590f0772e860
-- Boot 2444045887e84e9b81c74791f01b4ce0 --
Apr 27 12:53:30 raphael systemd[1017]: Starting KDE Connect...
Apr 27 12:53:30 raphael systemd[1017]: Started KDE Connect.
Apr 27 12:53:49 raphael kdeconnectd[2229]: QThreadStorage: entry 8 destroyed before end of thread 0x64d5114a0860
Apr 27 12:53:49 raphael kdeconnectd[2229]: QThreadStorage: entry 3 destroyed before end of thread 0x64d5114a0860
Apr 27 12:53:49 raphael kdeconnectd[2229]: QThreadStorage: entry 2 destroyed before end of thread 0x64d5114a0860
-- Boot c550036982c247ec9524137bbe544f03 --
Apr 27 13:03:05 raphael systemd[1020]: Starting KDE Connect...
Apr 27 13:03:05 raphael systemd[1020]: Started KDE Connect.
Apr 27 13:03:50 raphael kdeconnectd[2199]: QThreadStorage: entry 8 destroyed before end of thread 0x60d6e0c96860
Apr 27 13:03:50 raphael kdeconnectd[2199]: QThreadStorage: entry 3 destroyed before end of thread 0x60d6e0c96860
Apr 27 13:03:50 raphael kdeconnectd[2199]: QThreadStorage: entry 2 destroyed before end of thread 0x60d6e0c96860
-- Boot 00332574a5af49e186d5d0bbd2194156 --
Apr 28 11:01:57 raphael systemd[1016]: Starting KDE Connect...
Apr 28 11:01:57 raphael systemd[1016]: Started KDE Connect.
Apr 28 11:02:15 raphael kdeconnectd[2231]: QThreadStorage: entry 8 destroyed before end of thread 0x61325a761860
Apr 28 11:02:15 raphael kdeconnectd[2231]: QThreadStorage: entry 3 destroyed before end of thread 0x61325a761860
Apr 28 11:02:15 raphael kdeconnectd[2231]: QThreadStorage: entry 2 destroyed before end of thread 0x61325a761860
Comment 4 otiskujawa 2025-05-05 20:12:26 UTC
(In reply to Rob Emery from comment #2)
> Just tried to reproduce this and I can't get it to hang like you're seeing.
> Using arch, KDEConect 24.04.0 all freshly installed. 
> 
> I'm wondering if you have some bluetooth stack installed but no hardware and
> that behaves differently to what I have here (no bluetooth stack installed
> and no hardware either). 
> 
> Does this output match for you:
> ```
> [rob@ISIS-arch kdeconnect]$ pacman -Q | grep -i blue
> bluez-libs 5.82-1
> ```
> 
> or do you have additional bluetooth packages on?

This arch installation is a bit old and i did many things while using it in past so it may be a little bloated.
$ pacman -Q | grep -i blue
bluealsa 4.1.1-1
bluedevil 1:6.3.4-1
blueman 2.4.4-1
blueprint-compiler 0.16.0-1
bluez 5.82-1
bluez-libs 5.82-1
bluez-qt 6.13.0-1
bluez-qt5 5.116.0-1
bluez-utils 5.82-1
gnome-bluetooth-3.0 47.1-1
Comment 5 Rob Emery 2025-05-07 18:48:03 UTC
Very interesting. So I've added that lot of packages and I've not got any change in behaviour. 

The lack of the log from kdeconnect saying there's no bluetooth adapters fits with there being something not quite detecting right.

What do you get for the output for:
```
sudo bluetoothctl list
sudo systemctl status bluetooth
find /sys/class/bluetooth/*/
```

I'm expecting that there is some sort of BT device detected that is tripping everything up.
Comment 6 cwo 2025-05-25 10:36:36 UTC
*** Bug 504690 has been marked as a duplicate of this bug. ***
Comment 7 otiskujawa 2025-06-05 16:48:09 UTC
Host is desktop without any bluetooth adapter.
Bluetooth is disabled but issue used to persist if it's enabled.
But now i tried again on KDE Connect 25.04.1and issue is gone.
I cannot reproduce issue anymore

Current versions:
KDE Frameworks 6.14.0
Qt 6.9.0
Kernel 6.14.6-arch1-1
X11
Only hardware change i made was power supply upgrade (upgrade from 500W to 1000W, old power supply is fully functional and is currently used in different computer)
I will enable bluetooth backend for now and report back if issue comes back after reboot or in specific conditions.

(In reply to Rob Emery from comment #5)
> What do you get for the output for:
> ```
> sudo bluetoothctl list
> sudo systemctl status bluetooth
> find /sys/class/bluetooth/*/
> ```

```
$ bluetoothctl 
Waiting to connect to bluetoothd...

$ sudo systemctl status bluetooth
○ bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:bluetoothd(8)

Jun 05 16:26:46 raphael systemd[1]: Bluetooth service was skipped because of an unmet condition check (ConditionPathIsDirectory=/sys/class/bluetooth)

$ find /sys/class/bluetooth/*/
find: ‘/sys/class/bluetooth/*/’: No such file or directory
```
Comment 8 Rob Emery 2025-06-06 18:51:26 UTC
Excellent, that's at least consistent with what I'm seeing. If it does reappear, can you check the bluez service status, my hunch is that somehow bluez ends up running so that QTBluetooth can't determine the status properly and ends up attempting to iterate the bluetooth devices when it shouldn't/can't.
Comment 9 otiskujawa 2025-06-09 15:47:18 UTC
After reboot, plasmashell still freezes if bluetooth backend is enabled but no adapter is present.

```
○ bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:bluetoothd(8)

Jun 09 17:32:09 raphael systemd[1]: Bluetooth service was skipped because of an unmet condition check (ConditionPathIsDirectory=/sys/class/bluetooth).
Jun 09 17:32:32 raphael systemd[1]: Bluetooth service was skipped because of an unmet condition check (ConditionPathIsDirectory=/sys/class/bluetooth).
Jun 09 17:33:46 raphael systemd[1]: Bluetooth service was skipped because of an unmet condition check (ConditionPathIsDirectory=/sys/class/bluetooth).

$ find /sys/class/bluetooth/*/
find: ‘/sys/class/bluetooth/*/’: No such file or directory

$ bluetoothctl 
Waiting to connect to bluetoothd...
```
Bluetoothctl command doesn't exit still waiting for bluetoothd

So i decided to check with (cheap) usb bluetooth adapter
And plasmashell issue disappears

```
dmesg:
[  473.900943] usb 1-3: new full-speed USB device number 9 using xhci_hcd
[  474.269418] usb 1-3: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[  474.269424] usb 1-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[  474.269426] usb 1-3: Product: CSR8510 A10
[  474.345231] usbcore: registered new interface driver btusb
[  474.347455] Bluetooth: hci0: CSR: Setting up dongle with HCI ver=6 rev=22bb
[  474.347459] Bluetooth: hci0: LMP ver=6 subver=22bb; manufacturer=10
[  474.404627] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  474.404631] Bluetooth: BNEP filters: protocol multicast
[  474.404636] Bluetooth: BNEP socket layer initialized
[  474.570630] Bluetooth: MGMT ver 1.23
[  474.578074] Bluetooth: RFCOMM TTY layer initialized
[  474.578085] Bluetooth: RFCOMM socket layer initialized
[  474.578089] Bluetooth: RFCOMM ver 1.11

$ find /sys/class/bluetooth/*/
/sys/class/bluetooth/hci0/
/sys/class/bluetooth/hci0/uevent
/sys/class/bluetooth/hci0/power
/sys/class/bluetooth/hci0/power/runtime_active_time
/sys/class/bluetooth/hci0/power/runtime_status
/sys/class/bluetooth/hci0/power/autosuspend_delay_ms
/sys/class/bluetooth/hci0/power/runtime_suspended_time
/sys/class/bluetooth/hci0/power/control
/sys/class/bluetooth/hci0/reset
/sys/class/bluetooth/hci0/rfkill0
/sys/class/bluetooth/hci0/rfkill0/uevent
/sys/class/bluetooth/hci0/rfkill0/hard_block_reasons
/sys/class/bluetooth/hci0/rfkill0/soft
/sys/class/bluetooth/hci0/rfkill0/power
/sys/class/bluetooth/hci0/rfkill0/power/runtime_active_time
/sys/class/bluetooth/hci0/rfkill0/power/runtime_status
/sys/class/bluetooth/hci0/rfkill0/power/autosuspend_delay_ms
/sys/class/bluetooth/hci0/rfkill0/power/runtime_suspended_time
/sys/class/bluetooth/hci0/rfkill0/power/control
/sys/class/bluetooth/hci0/rfkill0/device
/sys/class/bluetooth/hci0/rfkill0/index
/sys/class/bluetooth/hci0/rfkill0/type
/sys/class/bluetooth/hci0/rfkill0/subsystem
/sys/class/bluetooth/hci0/rfkill0/state
/sys/class/bluetooth/hci0/rfkill0/hard
/sys/class/bluetooth/hci0/rfkill0/name
/sys/class/bluetooth/hci0/rfkill0/persistent
/sys/class/bluetooth/hci0/device
/sys/class/bluetooth/hci0/subsystem

● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: disabled)
     Active: active (running) since Mon 2025-06-09 17:39:51 CEST; 1min 28s ago
 Invocation: 55f96cf727654cfe92beaecae8c53811
       Docs: man:bluetoothd(8)
   Main PID: 18140 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 38278)
     Memory: 2.1M (peak: 2.9M)
        CPU: 41ms
     CGroup: /system.slice/bluetooth.service
             └─18140 /usr/lib/bluetooth/bluetoothd

Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/aptx_ll_1
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/aptx_ll_0
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/aptx_ll_duplex_1
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/aptx_ll_duplex_0
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/faststream
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/faststream_duplex
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSink/opus_05
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/opus_05
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSink/opus_05_duplex
Jun 09 17:39:51 raphael bluetoothd[18140]: Endpoint registered: sender=:1.50 path=/MediaEndpoint/A2DPSource/opus_05_duplex
```
So app works fine but plasmashell freezes some time after starting if no adapter is present.
Comment 10 Rob Emery 2025-06-27 18:06:56 UTC
Fix for the underlying behaviour is implemented in https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/837