apache / apache/mynewt-nimble

Crash when a lot of data needs to be proxied

Open
#1,220 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
893
Forks
512
Avg merge
13d 31m
Merged PRs (30d)
7

Description

# Problem Describing

Can't alloc os_mbuf when a lot of data needs to be proxied in BLE-MESH, so `om` is null to cause crash(assert).

```
static int proxy_send(uint16_t conn_handle, const void *data, uint16_t len) {
···
BT_DBG("%u bytes: %s", len, bt_hex(data, len));
om = ble_hs_mbuf_from_flat(data, len);
assert(om);
err = ble_gatts_notify_custom(conn_handle, svc_handles.proxy_data_out_h, om);
notify_complete();
···
}
```

# Related

These are also handled with assert: [pb_gatt_srv.c#L410-L411](https://github1s.com/apache/mynewt-nimble/blob/master/nimble/host/mesh/src/pb_gatt_srv.c#L410-L411) and [proxy_srv.c#L876-L877](https://github1s.com/apache/mynewt-nimble/blob/master/nimble/host/mesh/src/proxy_srv.c#L876-L877). We should reconsider how to deal with it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with proxy_send in the BLE-MESH proxy path, then inspect the assert sites in pb_gatt_srv.c#L410-L411 and proxy_srv.c#L876-L877. Determine how allocation failure should be handled instead of asserting; done means these paths no longer crash when an os_mbuf cannot be allocated, with the behavior validated against the project’s existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.