From 92979706d7dcaa5b5e962ff6382bdfa153f4b99f Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Tue, 7 Apr 2026 14:35:50 +0800 Subject: [PATCH] fix(ble_log): handle scheduler-suspended state in ble_log_rt_queue_trans During light sleep transitions, the FreeRTOS scheduler is suspended but xPortInIsrContext() returns false, causing xQueueSend with portMAX_DELAY to hit a configASSERT. Add a check for taskSCHEDULER_SUSPENDED and use a non-blocking send with rollback on queue-full to avoid resource leaks. --- components/bt/common/ble_log/src/ble_log_rt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/bt/common/ble_log/src/ble_log_rt.c b/components/bt/common/ble_log/src/ble_log_rt.c index c055dcd0fc..b2aabe6c80 100644 --- a/components/bt/common/ble_log/src/ble_log_rt.c +++ b/components/bt/common/ble_log/src/ble_log_rt.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -185,8 +185,15 @@ BLE_LOG_IRAM_ATTR void ble_log_rt_queue_trans(ble_log_prph_trans_t **trans) if (BLE_LOG_IN_ISR()) { BaseType_t woken = pdFALSE; + /* Queue depth == total transport buffer count; queue-full is impossible + * for a valid transport, so the return value is not checked. */ xQueueSendFromISR(rt_queue_handle, trans, &woken); portYIELD_FROM_ISR(woken); + } else if (xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) { + /* Non-blocking send to avoid configASSERT when scheduler is suspended + * (e.g., during light sleep transitions). Queue-full is impossible; + * see comment above. */ + xQueueSend(rt_queue_handle, trans, 0); } else { xQueueSend(rt_queue_handle, trans, portMAX_DELAY); }