Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Event data synchronization in ble_adapter is very fragile #43

Open
rmcgregor1990 opened this issue Oct 10, 2017 · 1 comment
Open

Event data synchronization in ble_adapter is very fragile #43

rmcgregor1990 opened this issue Oct 10, 2017 · 1 comment
Labels

Comments

@rmcgregor1990
Copy link

rmcgregor1990 commented Oct 10, 2017

Synchronizing event requests with responses using the EvtSync class in ble_adapter.py is somewhat fragile in the following respects:

  • If an event response doesn't arrive before its timeout its just returns the data from the last event without any error raised (condition.wait() doesn't raise any timeout exceptions, in fact in python 2 there is no way to tell whether it timed out or not).
  • If an event response arrives before the waiting thread manages to enter its condition lock, we will miss it entirely.
  • The same data reference is handed out to all waiting threads. This is fine if data is immutable, but probably should be explicitly stated somewhere.
  • Only a single reference is used to hold event data for all possible events. This opens the possibility of race conditions where the waiter receives event data from the wrong event.

Currently the most alarming issue is that if the event wait times out, data from the previously handled event is returned without any error raised. This can lead to very hard to diagnose bugs.

@bihanssen bihanssen added the bug label Jan 29, 2019
@bihanssen
Copy link
Contributor

@rmcgregor1990 sorry for no response. Thanks for reporting.

Issue related to #55.

h1562075881 added a commit to h1562075881/pc-ble-driver-py that referenced this issue May 24, 2023
…miconductor#43, refer from issue NordicSemiconductor#55.

2.ble_adapter optimizes the write_req and write_cmd functions to resolve an error when the length of a command sent is longer than att_mtu.
3.ble_driver._subversion_number_to_softdevice_info Adds new softdevice information
4. Add new print information to observers.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants