Skip to content

BLE_HS_ENOMEM After Number of Indications Exceeds BT_NIMBLE_GATT_MAX_PROCS #106

@ryancog

Description

@ryancog

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

I'm running on ESP-IDF v5.4.2 (the latest version I see), and am experiencing an issue that I'm not entirely certain how to track down.

I have an esp32s3 configured as a BLE peripheral, connected to a phone application functioning as the central. I utilize a write/indicate model for accomplishing asynchronous esp32s3-side processing and data fetching, and so heavily utilize indications.

For one part of my project, I write a new value (a new name for the device), the device (esp32s3) is meant to update this value (which involves ble_svc_gap_device_name_set and an NVS store), and then ble_gatts_indicate after it has been updated.

The application subscribes to the indications as soon as it connects, and so upon receiving this new indication, it updates the value displayed in the UI.

Actual behavior (suspected bug)

Recently, upon a characteristic being written and the esp32s3 code completing the action and proceeding to indicate, the indication never reaches the phone application, and if I try to write trigger the action after this (accomplished via manual input in the phone app), after I try BT_NIMBLE_GATT_MAX_PROCS times, ble_gatts_indicate_custom() returns BLE_HS_ENOMEM. With NimBLE debug logging enabled, this final failed indication does not result in a "GATT procedure initiated" log.

Looking through the ble source and based on the behavior, my best guess is that it fails at ble_gattc_proc_alloc because, for whatever reason, those indications aren't being processed by NimBLE.

I'm not sure how best to troubleshoot this however, as I'm not intimately familiar with the NimBLE source.

Error logs or terminal output

Steps to reproduce the behavior

My application is not trivial at this point, and I'm currently working on trying to set up a somewhat workable MRE. For completion's sake here's the general outline:

  1. Connect to esp32s3 running NimBLE with phone application (via flutter_blue_plus)
  2. Subscribe to indications for name characteristic
  3. Trigger name characteristic write with new value via application UI
  • Indication is not received
  1. Repeat until ENOMEM is returned.

I can share more information as requested, although I'm not sure what may be precisely useful.

Project release version

ESP-IDF v5.4.2

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

OpenSUSE Slowroll

Shell

ZSH

Additional context

This seems like it may be connected to #75, but there's not meaningful information there that is supplementary to my issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions