-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bluepy-helper crashes #40
Comments
Can you post your command line and log of script output while this error occurs? |
I run the following script from cron.hourly: `#!/bin/bash Read Mijia bluetooth temperature sensors. Trashwarez, 28.7.2020( exit Top shows then: ` " PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 29309 root 20 0 3744 672 584 R 99,7 0,0 21:36.03 bluepy-helper` Killing the process leaves this:
|
Please pipe the whohle output to a logfile and post it here when it crashes. When it gets stuck at "Trying to connect" is killing bluepy really sufficient? On one RPi I have the problem that I have to reboot it completely otherwise no sensors are polled at all. |
As already told above it just gets stuck. NO MORE OUTPUT
It just is stuck then. And yes, it works fine again after having killed bluepy. No reboot or hci0 up / down necessary. The script just continues after having killed the process and even finally succeeds on the connection...
|
Hi Trashwarez, thanks for the log. That helps debugging the problem. It seems bluepy-helper is not killed/terminated even the program has code for that case. You seem to run the script as root user, that seems to cause the problem. Querying the sensor doesn't require root priviledges and thus it shouldn't be executed as root. Executing as normal user worked perfect in my test cases. For your usecase and problem I suggest adding a line after |
Running the script as root does not cause the problem because it happens on other users as well, e.g. user pi:
And the suggested "sudo killall bluepy-helper" will never be executed when the python script gets stuck in the middle by bluepy-helper. |
I think the stuck bluepy helper is from a previous execution of the script. My scripts run 24/7 and never hang because of bluepy-helper. So when you kill any remaining bluepy-helper after the first execution round of all scripts it should work. |
As it just got stuck on the very first run after reboot as user pi, I killed it. Let's hope that your recommendation works on later cron calls. Edit: No, it does not work. It even got stuck after second call using user pi: 3465 pi 20 0 3744 628 540 R 99,7 0,0 0:14.23 bluepy-helper What is your system on which the script runs stable 24/7? Mine is a Pi 4 with 4 GB running on raspbian buster with latest updates. Does your script run like mine 4 times in a row, requesting data from 4 sensors? |
My system is a RPi Zero W currently running Raspbian Buster 4.19.93+ the other stable system is running 4.19.97+ RPi4 has compared to Zero W a reduced Bluetooth range. Could cause problems, but I don't think in your case. RPi4 has a lot of problems with Bluetooth and or Wifi according to this RPi-Distro/firmware-nonfree#8 On a PI 4 which I used to update the script in the last few days, I'm on 4.19.118-v7l+ There I've only polled for a few seconds, but it worked.
Perhaps that helps. But as I only used for a few seconds, I recommend trying other bluez versions. |
Hmm. Here is running kernel 5.4.51-v7l+ Your sentence "The start the script for each sensor at boot and then the script runs all the time, no more execution via cron, only once at boot." tells me that we are using a different approach. |
Try another bluez version, like described in the linked github issue. Yeah thats a different approach.
|
I've the same issue, when call |
I suggest trying the new ATC firmware mode #44 |
bluepy-helper crashes on a PI 4 after some time. Sometimes a few hours, sometimes longer. Quite difficult to track. bluepy-helper then uses 100 % CPU and connection to this MAC address. Watchdog does not seem to work.
The text was updated successfully, but these errors were encountered: