Skip to content

esp32*: esp_now: failed assertion in xSemaphoreTakeRecursive() when switching channel #21919

@benpicco

Description

@benpicco

Description

When changing the channel on an esp-now interact, an assertion triggers as xSemaphoreTakeRecursive() is called on a non-recursive Mutex.

Steps to reproduce the issue

Flash e.g. examples/networking/gnrc/networking on any board from the ESP32 family.
You should get an esp-now interface


Now try to change the channel with ifconfig 10 set chan 1.

Expected results

The esp-now channel changes.

2025-11-28 17:23:14,747 # ifconfig 11 set chan 1
2025-11-28 17:23:14,759 # success: set channel on interface 11 to 1

(works on esp8266)

Actual results

2025-11-28 15:45:33,687 # ifconfig 10 set chan 1
2025-11-28 15:46:50,184 # [DEBUG] esp_wifi_set_config()
2025-11-28 15:46:50,185 # cpu/esp_common/freertos/semphr.c:177 => FAILED ASSERTION.

On line 177 we find

assert(rsem->type == queueQUEUE_TYPE_RECURSIVE_MUTEX);
#0  0x40808414 in xSemaphoreTakeRecursive (xSemaphore=0x4081c5c0, xTicksToWait=xTicksToWait@entry=4294967295)
    at /home/[email protected]/dev/RIOT/cpu/esp_common/freertos/semphr.c:178
#1  0x40804576 in mutex_lock_wrapper (mutex=<optimized out>) at /home/[email protected]/dev/RIOT/build/pkg/esp32_sdk/components/esp_wifi/esp32c6/esp_adapter.c:202
#2  0x42048a3a in clear_mac_queue ()
#3  0x4204a0a0 in wifi_softap_stop ()
#4  0x4205b7fc in wifi_softap_set_config ()
#5  0x4205d42c in wifi_set_config_process ()
#6  0x4205a74a in ieee80211_ioctl_process ()
#7  0x4080fa7a in ppTask ()
#8  0x40806d48 in sched_switch (other_prio=50624) at /home/[email protected]/dev/RIOT/core/sched.c:300

(gdb) p *rsem
$3 = {type = 1 '\001', pid = 0, rmutex = {mutex = {queue = {next = 0x0}}, refcount = 50616, owner = 16513}}

Versions

RIOT master / 2025.10-RC3

Metadata

Metadata

Assignees

Labels

Platform: ESPPlatform: This PR/issue effects ESP-based platformsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions