High CPU Usage even if unused
Closed this issue · 8 comments
Hi all,
I recognized an issue in a RPI3 using bt speaker to use the Pi as an audio transceiver. First of all, bt-speaker is working fine without problems. I do not use the builtin WLAN module to avoid the sound problems.
After some time, even if not used, the python-process of bt-speaker constantly causes high cpu usage (100% on one core). How can I help to investigate?
Regards,
Hmmm,
maybe a first step would try to find out if the load comes from inside the C library or python.
Probably it comes from python if the load is also high when not playing audio.
Approaches I could think of are:
- Add debug logging in code
- Monitor the DBUS for abnormalities
Maybe its even GLib responding unnecessarily to something.
Personally I never experienced (or noticed) that issue since I use the Pi exclusively for bluetooth in my project.
I am experiencing this as well. It seems to happen shortly after the first bluetooth disconnect after a boot; at least for me. I'm running bt-speaker on a RPi 3 using an up-to-date retropie image (installed retropie 4.2, then updated setup script and retropie packages using retropie's updater). Also using ethernet, wifi is disabled via /boot/config.txt; I am using the onboard bluetooth however.
Restarting bt_speaker resolves the issue immediately. I can confirm that it happens after disconnecting. Nevertheless the service seems to work fine, even with high cpu usage.
I can confirm it now.
Will definitely look into this and try to fix it tonight or tomorrow.
It looks like the raw_audio
function is called in an infinite loop, probably with empty data.
A simple sleep should fix this if there is no better solution.
n1, will validate your changes soon. Thanks
Turns out that bluez does not tell to release the filedescriptor of the audio stream on disconnect and the GObject listener went crazy.
It should be fixed now.
Confirmed fixed for me (retropie 4.2 base image, packages all up-to-date as of 2017-07-16). Thanks!! Working great :-)
confirmed - Thanks!