maybe a timer overflow? The old ticker class had a problem for a long time with handling timer overflows. I think it was about 3 weeks runtime for a µs counter for an overflow.
Is the real code using a static function for radioRoutine() or is it a member function? I’m not sure if calling a member function is adding some dynamic memory usage.
It calls a member function. It is hard to imagine how EventQueue itself just stops working. Is it possible radioThread somehow crashed or stopped running? Or stuck in some sort of waiting (for Mutex, EventFlag etc.)?
This seems to be a very rare situation, so far I have seen it happen only once.
The routine itself just transforms and moves bytes array around. I printed out memory usage of each thread, found that radioThread typically uses 3896B, which is very close to the reserved 4096B. My speculation is, at some point, system restarted by watchdog, then didn’t have enough RAM in that thread to start radioRoutineEvQue.
There is a mutex, but it is very unlikely that was the cause.
This is a weird part that I don’t fully understand. The memory usage by that thread is usually 3096B when binary is compiled by ARMC6. If binary is compiled by GCC, then the memory usage is over 4KB outright. There are some other stuff going on in that thread, depending on factors I don’t fully understand, memory usage by that thread may be slightly more or less. Because it is close to reserved 4KB, in certain scenario, it will fail to start EventQueue. I increased reserved memory to 8KB, hopefully that will prevent it from happening again.