Skip to content
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

panicked at 'unexpected event 59' #285

Open
HaoboGu opened this issue Dec 17, 2024 · 0 comments
Open

panicked at 'unexpected event 59' #285

HaoboGu opened this issue Dec 17, 2024 · 0 comments

Comments

@HaoboGu
Copy link
Contributor

HaoboGu commented Dec 17, 2024

Recently I encountered some runtime panics, the following is the log:

DEBUG on_data_length_update conn_handle=4 max_rx_octets=251 max_rx_time_us=2120 max_tx_octets=251 max_tx_time_us=2120
└─ nrf_softdevice::ble::gap::on_evt @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:125 
DEBUG on_conn_param_update conn_handle=4 conn_sup_timeout=100 max_conn_interval=12 min_conn_interval=12 slave_latency=4
└─ nrf_softdevice::ble::gap::on_evt @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:125 
ERROR panicked at 'unexpected event 59'
└─ nrf_softdevice::ble::gatt_client::att_mtu_exchange::{async_fn#0}::{closure#2} @ /Users/haobogu/.cargo/git/checkouts/nrf-softdevice-03ef4aef10e777e4/d5f023b/nrf-softdevice/src/fmt.rs:101 
ERROR panicked at /Users/haobogu/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/defmt-0.3.10/src/lib.rs:380:5:
explicit panic
└─ panic_probe::print_defmt::print @ /Users/haobogu/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/panic-probe-0.3.2/src/lib.rs:104 

It seems that there's a timeout when exchanging mtu:

portal(conn_handle)
.wait_once(|ble_evt| unsafe {
match (*ble_evt).header.evt_id as u32 {
raw::BLE_GAP_EVTS_BLE_GAP_EVT_DISCONNECTED => return Err(MtuExchangeError::Disconnected),
raw::BLE_GATTC_EVTS_BLE_GATTC_EVT_EXCHANGE_MTU_RSP => {
let gattc_evt = match check_status(ble_evt) {
Ok(evt) => evt,
Err(e) => return Err(e.into()),
};
let params = get_union_field(ble_evt, &gattc_evt.params.exchange_mtu_rsp);
let mtu = params.server_rx_mtu;
debug!("att mtu exchange: got mtu {:?}", mtu);
conn.with_state(|state| state.att_mtu = mtu);
Ok(())
}
e => panic!("unexpected event {}", e),
}
})
.await

Is there any methods to avoid this panic or manually handle it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant