mbl_mw_datasignal_log Crashes
Hi I'm investigating a case where mbl_mw_datasignal_log
is called after sensor is disconnected unexpectedly and leads to app crashing. The line crashes happen is state->create_next(true);
inside the mbl_mw_datasignal_log
timeout. The exception can't be handled in our code because it is outside the logger callback. Is this a bug in the SDK or are we missing something? The code works fine if it is connected. This only happens if the sensor is disconnected.
The following code should show the crash described:
device.apiAccessQueue.async {
if let signal = mbl_mw_sensor_fusion_get_data_signal(device.board,
MBL_MW_SENSOR_FUSION_DATA_CORRECTED_ACC) {
mbl_mw_metawearboard_set_time_for_response(device.board, 2000)
// Simulates unexpected disconnection
mbl_mw_debug_disconnect(device.board)
mbl_mw_datasignal_log(signal, nil, { (context, logger) in
if let logger = logger {
// Set Logger
} else {
// Handles nil
}
})
}
}
Comments
Changing
if (force)
toif (force && !pending_fns.empty())
in C++ SDK'sAsyncCreator::create_next
seems to fix the problem. Does this make sense?Yes, the empty check should happen since the disconnect handler clears the
pending_fns
queue.Thanks for bringing that up. We'll add that in the next release
Hi Eric, is there any updates with the fix?
Thanks.
Sorry, it slipped through the cracks. An update to the C++ sdk has been pushed with this change.
I saw the fix in C++ SDK, but it's not part of the latest ios 3.2.0 pod. Can it be included in the next ios sdk update?
Thanks!
Yes