-
Notifications
You must be signed in to change notification settings - Fork 88
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
OutOfOrderGattCallbackException: Unexpected response type OnCharacteristicWrite received #497
Comments
What version of Kable are you using?
More specifically, Kable ensures that every I/O operation happens within a lock. For example, when a write request is initiated, the lock prevents other I/O operations until Kable gets a write response. If an unexpected response is received, i.e. receiving a read response callback when we had just performed a write request, then In most cases, this should not occur. I haven't seen the Android system giving unexpected responses, but that is what that exception is intended to inform you of (that failure case). There is some complexity around cancellation handling, so it is possible that the internal Kable bookkeeping has a bug. I would need more detailed logs to know more, and to help further. |
We came upon this issue with version 0.23.0. |
@grabbe-bryghtlabs can you provide logs to help debug the issue? |
This is a snippet
|
@grabbe-bryghtlabs thanks! I'll also need Kable logs leading up to the issue. With level |
This should be capturing the Events in the logger
|
Thanks! The very first line of those logs show a write to a characteristic but then shortly after you see the exception from Kable stating that it received a descriptor response. Is there any chance you can provide more of the logs leading up to the exception? |
Here is a log starting with the device connection:
|
This is after updating to 0.31.0 |
I have a vague suspicion that maybe you have two separate Can you look through how you're creating the peripheral and if there is a way you possibly have multiple separate objects representing the same peripheral (rather than multiple references to the same peripheral object). If you're having trouble isolating such a situation in your code, let me know, and I can add additional logging that will confirm/deny my suspicion. |
The way it is built out we have a single scan job and one instance of a peripheral. I don't think that would be the case. If there is a way that I can provide more logging, please let me know. I can run through the same scenario in an isolated environment this evening. |
I have some theories of what might be going wrong. I'll try to add some necessary logging to validate soon. Thanks for being patient. |
Just let me know what I can do. I appreciate your attentiveness |
Just wanted to confirm that I've seen this happen to around 6 of our customers. There are several thousand using the latest build, so the volume is relatively low.
Our current setup has peripherals cached in a map by their advertisement identifier (mac address), so there shouldn't be a case where we are using the same peripheral in two different spots. For what it's worth, our peripherals are generally connected to and disconnected from throughout the day. In either case, I can try to put some defense around our I/O operations. Would it be preferable to just reconnect the peripheral if this happens, or is this a recoverable scenario during a connection? |
Not sure about your scenario, but I've had this come up when updating firmware on a BLE device and it's unusable. We have another process to force our firmware to update, but it's a bit cumbersome and it would be nice to figure out why it's happening and if I can do anything to guard against it. We also have the peripheral in memory in a singleton. For general calls I have things wrapped in a retry with delay. |
I work on Android. Have been using this lib for more than one year. And now I got the case when I catch
OutOfOrderGattCallbackException
. The full text isOutOfOrderGattCallbackException: Unexpected response type OnCharacteristicWrite received
. The scenario is pretty simple: there are two characteristics. One I use to write byte arrays on a device, the second one is read the status of this "writing". And in one moment I get this exception. I found it is source code but its cause is not clear for me. Why do I get it?The text was updated successfully, but these errors were encountered: