TL;DR: you need to pull my latest esp-idf changes.
I've finally found & solved the strange priority changes for our
netmanager task (i.e. being raised suddenly from origin 5 to 18/22): the
bug was in the esp-idf posix threads mutex implementation.
I had suspected the mutex priority inheritance for a while, so added a
way to retrieve the internal mutex hold count for our task list. Using
this I noticed the hold count would always & only raise by 2 whenever
any kind of mongoose connection was closed.
That lead me to checking the thread concurrency protection for mongoose
mbufs, because every mongoose connection has two mbufs associated (rx &
tx), each having a posix mutex.
The bug was: posix mutexes were deleted after locking (taking) them.
FreeRTOS mutexes must not be deleted while being taken, that breaks the
priority inheritance (more precisely the disinheritance), with the
visible effect being the mutex hold count not returning to zero.
As a side effect, this may also solve the strange event task starvations
(hope so…). I was investigating this as I suspected some busy loop in
the netmanager context. With the netman running at prio 22, that would
effectively block almost all other processing including the timer
service. I've found & fixed one potential busy loop trigger in the
netman that would have been caused by the netman task still running
while all interfaces had been lost -- not sure if that could happen, but
it would explain the effects.
So please watch your crash debug info & report if the issue still turns up.
Regards,
Michael