My application using the posix port is getting deadlocked. I have found 2 different cases where it happens.
In the posix port the tick handler is implemented via a signal handler. signal handlers should not perform blocking calls. However I found 2 different cases where blocking calls are being made inside a posix signal handler (the tick interrupt).
I have screen captures of the stack trace in eclipse with my commentary showing the 2 different scenarios. These 2 screen captures are attached.
I was previously using the old William Davy posix port for many months which didn’t have this issue. I switched to the “official” posix port just 2 days ago and today I got complaints from other developers about random deadlocks. I investigated and found these 2 scenarios.
For the 1st deadlock when the task switch occurs while a thread is blocking on vTaskDelayUntil() I can’t think of a simple way to fix this.
For the 2nd deadlock I could see setting a flag in the tick handler to indicate that we are in an ISR and should not block. Then when vPortYield() if this flag is set then just return.
But for the 2nd deadlock situation when the signal handler occurs during vTaskDelayUntil() and then inside the tick handler the task suspends itself again I can’t yet think of a way around this.
This is much higher priority for me than the other issue with detecting stack overflow.
I’m probably going to have to go back to the old William Davy port to unblock my developers.
@gedeonag: Can you please have a look at this?