uxTaskGetSystemState() != uxTaskGetNumberOfTasks()

gremond wrote on Tuesday, September 05, 2017:

By analyzing a problem with random task disappearing, I added some logs and especially in a task counting nb tasks periodically.

So periodically I get total nb task with uxTaskGetNumberOfTasks() and then I check the status of all task with uxTaskGetSystemState which should return the same number of task, and sometimes I have something like this:
. uxTaskGetSystemState returns 49
. uxTaskGetNumberOfTasks returns 26 (which is the correct number)

The documentation say: “The number of TaskStatus_t structures that were populated by uxTaskGetSystemState(). This should equal the number returned by the uxTaskGetNumberOfTasks() API function, but will be zero if the value passed in the uxArraySize parameter was too small.”

It still does not explain why I have some task which disappear from the lists but it could be a way to the bug.

I am using FreeRTOS V9.0.0 and upgraded to V9.0.1 (trunk), same issue
My board is a STM32L4 in tickless configuration

rtel wrote on Wednesday, September 06, 2017:

There was an issue with vTaskGetInfo(), which is called from uxTaskGetSystemState(), indirectly, but if you have the head revision from SVN then you will already have the fix for that.

gremond wrote on Wednesday, September 06, 2017:

This issue happened with r2518 from SVN