-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
vTaskDelayUntil() method assertion failure (IDFGH-2045) #4230
Comments
@stuarthatchbaby Thanks for reporting the issue. Would you please help provide more details as suggested in the issue template? Information like elf, sdk configuration, backtrace, log outputs, commit ID, hardware and etc. would help us debug further. Thanks. |
@stuarthatchbaby
Assuming that This assert could trigger under the following scenario
As a temporary fix, try putting the assertion inside the critical section of the function (as shown below) and see if that resolves the issue: configASSERT( pxPreviousWakeTime );
configASSERT( ( xTimeIncrement > 0U ) );
taskENTER_CRITICAL(&xTaskQueueMutex);
configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] == 0 );
... |
Thanks! As background here's the backtrace:
Sound_mic is reasonably low priority (5) and not pinned. It lifts 160 byte chunks from a ring buffer, processes and dispatches over UDP, then waits for the remainder of 20ms. The incidence is high enough to cause pain, but realistically occurs per many-millions of calls so it does sound like a weird context-switch interaction as @Dazza0 suggests. We don't call vTaskSuspendAll(), or do any meaningful flash operations, but we do use Event Groups extensively and I see vTaskSuspendAll() hiding in there. I'm happy to move the assert. Does it make sense to pin the task as well? We've only got a couple of calls to vTaskDelayUntil() with the remaining instances being much slower. I don't think it would hurt functionality to pin any of them. |
@stuarthatchbaby Thanks for the updates, since this ticket was already closed and same with 4230, let us track the updates in 4230, thanks. |
@stuarthatchbaby But the onus should be on FreeRTOS functions to be thread safe. It seems like the thread safety of the I'll push a commit to fix this issue on master, then backport it to v3.3 |
@Dazza0 - As a quick work-around I've disabled the asserts in the functions above to produce a test build. It'll be several days before we get meaningful A/B metrics back but I'll update here once we have them. |
This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Closes #4230
This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Closes #4230
This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Closes #4230
This issue was earlier fixed in commit 79e74e5 but during migration to newer FreeRTOS release, it got introduced again. This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Relevant #4230 Closes #7726 Closes IDFGH-6041
This issue was earlier fixed in commit 79e74e5 but during migration to newer FreeRTOS release, it got introduced again. This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Relevant #4230 Closes #7726 Closes IDFGH-6041
This issue was earlier fixed in commit 79e74e5 but during migration to newer FreeRTOS release, it got introduced again. This commit fixes thread safety issues with configASSERT() calls regarding the value of uxSchedulerSuspended. A false negative occurs if a context switch to the opposite core occurs in between the getting the core ID and the assesment. Relevant #4230 Closes #7726 Closes IDFGH-6041
This issue is referenced in #391 which was closed against its original report, but there is a secondary issue in the comments which appears to still be an problem in 3.3.
Occasionally (every few-hundred user-hours where we call every second or so), vTaskDelayUntil() can abort with an assertion failure, as detailed below.
This causes a reboot, or sometimes a crash if the SW_CPU_RESET gets hung-up.
The text was updated successfully, but these errors were encountered: