Skip to content

ERROR "<< sendValue: failed to allocate mbuf" some time after the start of sending notifications. v2.2.3 #918

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

Open
truefalsenone opened this issue Mar 21, 2025 · 1 comment

Comments

@truefalsenone
Copy link

Hello,

I am using the ESP32-C3. My project has a BLE-client and a BLE-server. The NimBLE-Arduino version is v2.2.3.

The BLE-server sends notifications with a payload of 40 bytes 2 times per second. However, after some time (about 50 minutes), the notifications stop being sent, and in the server log I see an error: "<< sendValue: failed to allocate mbuf."

NimBLECharacteristic.cpp

// Must re-create the data buffer on each iteration because it is freed by the calls bellow.
os_mbuf* om = ble_hs_mbuf_from_flat(value, length);
if (!om) {
    NIMBLE_LOGE(LOG_TAG, "<< sendValue: failed to allocate mbuf");
    return false;
}

If I reconnect, the notifications are successfully sent again.
70 KB are free in a heap all the time.

@h2zero
Copy link
Owner

h2zero commented Mar 21, 2025

You should wait until the onStatus callback is invoked (checking for success of the last notification, rc==0) before sending the next notification. The issue in this case is that there is a connection issue between the devices and each time a notification is sent it consumes a buffer but if that doesn't get sent then the buffer doesn't get freed.

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

2 participants