I'm experiencing a deadlock when receiving an indication from a connected BLE devices.
The traces is as follows:
src/bluez/attrib/gattrib.c received_data() is called from the g_main_loop_run(),
Inside this function we take the attrib lock for the whole function, expect when calling c->func here
From received_data() we can then call evt->funchere which in my case is calling the events_handler function from src/gattlib.cpp:291. The lock was not released before calling the event function.
events_handler can call g_attrib_send() which then tries to acquire the lock again leaving the program in a deadlock.
I tried releasing the lock and re-acquiring the lock before/after calling evt->func and that worked for my case, but I don't know whether that's the right solution. This deadlock was introduced by #11.
Aye, indications can do that. So could notifications in theory, if the on_notification handler attempts to, say, read an attrib from within the handler.
I'm experiencing a deadlock when receiving an indication from a connected BLE devices.
The traces is as follows:
src/bluez/attrib/gattrib.c
received_data() is called from the g_main_loop_run(),received_data()
we can then callevt->func
here which in my case is calling theevents_handler
function from src/gattlib.cpp:291. The lock was not released before calling the event function.events_handler
can callg_attrib_send()
which then tries to acquire the lock again leaving the program in a deadlock.I tried releasing the lock and re-acquiring the lock before/after calling
evt->func
and that worked for my case, but I don't know whether that's the right solution. This deadlock was introduced by #11.References: https://github.com/oscaracena/pygattlib/blob/7cdeceb9e46f1aa70e28e5f3f861875685bc1cd9/src/gattlib.cpp#L291
https://github.com/oscaracena/pygattlib/blob/7cdeceb9e46f1aa70e28e5f3f861875685bc1cd9/src/bluez/attrib/gattrib.c#L479