-
Notifications
You must be signed in to change notification settings - Fork 160
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
Scanning silently stops working #79
Comments
I am seeing this issue on OS X 10.15.5 / Mid-2014 MBP while scanning for advertisments either using this package directly, or via another wrapper with even the simplest code like [below]. It seems to happen after about an hour, but can also take longer.
Going to do some tests to see if any actions like exiting and restarting the node script after a certain interval or recreating the noble object at an interval helps; and then go from there. Hard to tell if it's an OS or library issue. |
So far in my testing the issue seems to have gone away if I stop and restart scanning after, say ~10 min (it seems not necessary to restart the whole node script). Perhaps there is some kind of internal timeout at some point in the stack where the scanning stops if you've had it running too long or it has received too many messages? The advertising messages I am capturing arrive every ~20 sec, so this may all be different for you. |
I have a similar issue with Python, so this problem is perhaps not related to noble. I use a watchdogtimer. If after X seconds no BLE packets are received, I stop scan and start again. That helps. def keepingLEScanRunning(): #LE-Scanning gets disabled sometimes, especially if you have a lot of BLE connections, this thread periodically enables BLE scanning again
global BLERestartCounter
while True:
time.sleep(1)
now = time.time()
if now - lastBLEPaketReceived > args.watchdogtimer:
print("Watchdog: Did not receive any BLE Paket within", int(now - lastBLEPaketReceived), "s. Restarting BLE scan. Count:", BLERestartCounter)
disable_le_scan(sock)
enable_le_scan(sock, filter_duplicates=False)
BLERestartCounter += 1
print("")
time.sleep(5) #give some time to take effect For fullcode see https://github.com/JsBergbau/MiTemperature2/blob/master/LYWSD03MMC.py |
I'm using this library in an app which scans for advertisements. I'm getting reports that this scan silently stops working after a while (timeframe of minutes to hours). As you can see in the log attached to AlCalzone/ioBroker.ble#391 (comment), the scan generates a bunch of data every couple of milliseconds starting at
08:46:01.045
until08:48:36.292
, then there is a sudden silence.Do you guys have any clue how to start investigating this?
The text was updated successfully, but these errors were encountered: