Debugging stalled threads - volatile variables, others?
Posted: Wed Aug 07, 2019 8:55 pm
Quick questions: any good way to find out WHERE a thread is stalling out, particularly a packet event handler for Wifi?
My current plan is to put in lots of writes to a volatile variable in the code that is stalling, and have the main loop (which is still running) print out that variable's value periodically.
* Will this work? I'm assuming the compiler will NOT move the volatile writes within the code, but perhaps that isn't the case.
* Is there some other magical way to find out where a stalled thread is stalling out?
Context: I'm sending a continuous stream of UDP packets to the ESP32, and it periodically hangs the message handling. The send rate isn't high (10 a second for example). I do know UDP can drop packets, which shouldn't be an issue. Anyone see something like this before? Too early to ask about the specific code, since haven't deeply debugged it yet, but perhaps this will sound familiar to someone.
My current plan is to put in lots of writes to a volatile variable in the code that is stalling, and have the main loop (which is still running) print out that variable's value periodically.
* Will this work? I'm assuming the compiler will NOT move the volatile writes within the code, but perhaps that isn't the case.
* Is there some other magical way to find out where a stalled thread is stalling out?
Context: I'm sending a continuous stream of UDP packets to the ESP32, and it periodically hangs the message handling. The send rate isn't high (10 a second for example). I do know UDP can drop packets, which shouldn't be an issue. Anyone see something like this before? Too early to ask about the specific code, since haven't deeply debugged it yet, but perhaps this will sound familiar to someone.