task-ble: hold NimBLE host lock around ble_hs_id_copy_addr (ESP-IDF v5.4+) - #1
Open
joalavedra wants to merge 1 commit into
Open
task-ble: hold NimBLE host lock around ble_hs_id_copy_addr (ESP-IDF v5.4+)#1joalavedra wants to merge 1 commit into
joalavedra wants to merge 1 commit into
Conversation
ESP-IDF v5.4+ ships a NimBLE update whose ble_hs_id_addr asserts
ble_hs_locked_by_cur_task() under CONFIG_BT_NIMBLE_DEBUG=y. Calling
ble_hs_id_copy_addr from the sync_cb (as onSync does) without explicitly
holding the host lock now panics:
assert failed: ble_hs_id_addr ble_hs_id.c:295 (ble_hs_locked_by_cur_task())
Wrap the call in ble_hs_lock()/ble_hs_unlock() and forward-declare both
from NimBLE's private header so we don't need to pull in ble_hs_priv.h.
Affected build: ESP-IDF >= 5.4 with default NimBLE debug settings.
Workaround for users on this commit: set CONFIG_BT_NIMBLE_DEBUG=n in
sdkconfig.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ESP-IDF v5.4 ships a NimBLE update where
ble_hs_id_addrassertsble_hs_locked_by_cur_task()underCONFIG_BT_NIMBLE_DEBUG=y. Callingble_hs_id_copy_addrfromonSync(the sync_cb) without explicitly holding the host lock now panics during NimBLE startup:(stack:
ble_hs_pvcy_set_default_irk→ble_hs_startup_go→ble_hs_sync→ble_hs_start)Older NimBLE was permissive for callers on the host task — the lock check is paranoid, the call itself is correct. The fix wraps it explicitly in
ble_hs_lock()/ble_hs_unlock()so the assertion is satisfied.ble_hs_locklives in NimBLE's private header (ble_hs_priv.h) so I forward-declare both rather than pulling the private include.Affected: anyone building this component against ESP-IDF >= 5.4 with default NimBLE settings — including
pixie-firmwareitself.Workaround for users on the current main: set
CONFIG_BT_NIMBLE_DEBUG=n. The patch makes that workaround unnecessary.Found while building pixie-agent-visualizer — a live AI-agent activity display on the Pixie.