Closed 1am closed 3 years ago
Hi, I just merge your PR #123. Let me know if you have any update on that situation. If you have a different approach to avoid the problem I would be glad to discuss and integrate to he codebase. Thanks!
Thank you. So far don't really have any better idea. I think it's more dependent on events coming from DBus in random order than anything that can be done by the library. But if I find something will let you know for sure
Hello,
I've been experiencing some random crashes on closed channels over the time of using the library. Tried to refactor my application code around the library in various aspects, mainly handling high volumes of BLE scan results, properly handling connection being terminated by peripheral side of the connection in random moments. For the most of it it was possible to rewrite the part to eventually handle these edge cases but still when running tests, once per ~5k tests the application crashes with:
This happened in a few places and I think there is no way around this except for suppressing the panic which I've fixed in https://github.com/muka/go-bluetooth/pull/123/files So far it seems to be working well.
To give you some example scenarios of the tests performed which manifested the issues.
Scanning test with hundreds hundreds of unique advertisers per second
This crashed very frequently because even after step 3 some advertisements came in afterwards. The channel was obviously closed so there was a reason for this but the application was taken down by the closed channel write
Terminating connection by peripheral
The random reset of peripheral device was triggered somewhere between steps 2-4 which is where I found that it was most problematic for the application I'm working on. Eventually it was fixed after some effort but still it was possible to get a characteristic notification
"Notify" true
being sent over DBUS long after device's"Connected" false
was handled by the application. This happens both on quite powerful PC with I7 and 16GB ram as well 400MHz and 64MB ram embedded SOM on both of which are my target platforms.I think these kinds of situations are not possible to address in any other way than being able to carry on after they happened.