Bug 435444 - bluetooth is constantly scanning for services / devices
Summary: bluetooth is constantly scanning for services / devices
Status: RESOLVED WORKSFORME
Alias: None
Product: Bluedevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.21.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-07 00:02 UTC by Kai Krakow
Modified: 2021-05-11 04:33 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Krakow 2021-04-07 00:02:23 UTC
SUMMARY

When the KDE session is running, my bluetooth dongle is constantly scanning for services and devices. The timeout is around 10s but it will immediately start again.

The effect of this is that some bluetooth-connected devices have problems communicating correctly with my PC because inquiries are prioritized over other bluetooth traffic with the effect it seems to completely dominate the bluetooth connection.

One affected device is the Xbox Elite 2 controller: While KDE is running, it is unstable and loses or delays input events. When KDE is stopped, the controller works just fine.

After an [issue report in the Bluez Github project](https://github.com/bluez/bluez/issues/123) I was told that it is neither normal nor expected/recommended to have the dongle in permanent scan/inquiry mode because that traffic is priorities above other traffic which could explain my problem. It doesn't matter if I disable any KDE services (kdeconnect, bluetooth events, ...): The dongle is constantly discovering for 10s, then immediately starts again in a loop. Sometimes after I rebooted, the pattern may be different: 10s of discovering, 10s of non-discovering.

This also seems to affect how well different devices may be able to connect via bluetooth: Without KDE running, my paired bluetooth devices connect immediately, with KDE running, the connection may take 30-60s before it is established.

STEPS TO REPRODUCE
1. Enable bluetooth
2. Watch the output of btmgmt or btmon
3. Try with KDE and without KDE running

OBSERVED RESULT

With KDE running, watch btmgmt to see "hci0 type 1 discovering on" / "... off" is looping with 10s in "on" state, and <1s in "off" state.

Without KDE running, no such behavior can be observed.

Bluetooth devices have difficulties to properly communicate with low latency while inquiries are running, this may have a HUGE impact on SOME devices, especially devices requiring low latency (input, audio) come to mind here.

EXPECTED RESULT

KDE (or some component of it) should not constantly scan trying to discover devices.

ADDITIONAL INFO

The "Add device" wizard is not running.

kdeconnect is running, it seems to have bluetooth integration.

kio may be involved: https://github.com/KDE/bluedevil/blob/bb28472500c1292c9059b06af937ed51b4cb02f8/src/kio/bluetooth/kiobluetooth.cpp#L159 (the 10s timeout is quite an evidence)

I already tried disabling pulseaudio and other bluetooth-integrated services. Only shutting KDE completely down resolves the issue.

Maybe related:
#308338, #401983

As per https://bugs.kde.org/show_bug.cgi?id=401983#c3 the kio thing looks promising. But how would I identify the process which is hammering the bluetooth:/ kio service?
Comment 1 Kai Krakow 2021-04-11 14:09:52 UTC
Killing kdeconnectd seems to stop this behavior.
Comment 2 David Edmundson 2021-04-11 14:21:33 UTC
>Killing kdeconnectd seems to stop this behavior.

Please confirm and move this to kdeconnectd.

A dbus monitor log of the culprit would also be useful
Comment 3 Kai Krakow 2021-04-11 18:00:28 UTC
Are there instruction on how to properly create a dbus monitor log?
Comment 4 Bug Janitor Service 2021-04-26 04:33:40 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 5 Bug Janitor Service 2021-05-11 04:33:39 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!