I am using an ESP32 to continuesly scan for BLE devices. There is a working watchdog tested to successfully restart the device.
After running for a couple of hours the device freezes and prints a few new lines on the serial but not any exception or stack trace. Also the device doesn't get restarted by the watchdog after that. After each scan I print the available heap space which is consistantly in the 36k range.
Any ideas to help debug this? Not posting any code yet because I'm in the process of stripping it gradually.
...............................................................................................................................................
Serial Input basics.
For instance, using the words "9v battery" in the search box one could find lots of reasons why this may be a bad idea.
Other search words include "level shifter", "round", "millis()",
.........................................................................................................
The events portrayed in this post are not all true. The names are not real names of real people and real organizations.
..............................................................................
One possibility is that the code is getting stuck in a loop somewhere which has the equivalent of a yield() or delay() in it which is enough to reset the watch dog timer.
Maybe flash a led in your loop() or loops to see if this could be the case.
sounds difficult to debug and reproduce.
sounds like you've already eliminated a memory leak
one approach is to track the progress of the code. i've used leds in smaller cases, the pattern of LEDs would indicate where it was when things went wrong. using prints don't always work because that last print never gets out
perhaps a set of counters, one for each block of code, printed out in loop() that may provide some hint at what parts of the code are being exercised
if there's a watchdog and it's not firing, how is it being reset when the code freezes? (hopefully not in an interrupt - past history)