Open efc opened 11 months ago
You may not be able to try this, but do you see the same crashes when you don't use mDNS?
Good question, Dan. Since this crash took overnight to manifest, it will take a while to test this out.
I plan to try running this code as-is, but attaching the board to a power supply instead of a computer to see if that resolves the problem. If it does not, then I will try removing the mDNS element from the code. That is a "would-be-nice" but not essential element of the project I envision, so I can live without it.
OK, I have run two tests with the board plugged into a power supply instead of the computer. Both failed.
In the first test I left the code as it was with mDNS above. This test ran for about 36 hours with a loop on another computer using the board's webserver to change the neopixel color every minute.
In the second test I commented out the mDNS lines. This one failed after about 90 minutes.
I doubt that the length of time between failures indicates very much, but the failure itself is a concern. In both cases the board failed with the same triple flashing of the neopixel I describe above, which I believe indicates it entered safe mode.
I am not terribly surprised that the adafruit_httpserver
is not very robust. I have had similar issues with past approaches to running web servers on microcontrollers. I guess in addition to just raising the issue and hoping the software can be improved, I am wondering two things: (1) Is there anything else I can do to produce more helpful diagnostic information for anyone who might be able to improve the server, and (2) can anyone suggest code I could add to either sense failure and restart the server or to cycle the server or microcontroller in some way that might at least bring it back to life after a failure?
The most immediate help is to use a safemode.py
file:
https://learn.adafruit.com/circuitpython-safe-mode
There are many other things that can be done for general robustness of circuit python projects. The Adafruit Discord server is a great place to ask about circuit python usage and customization.
@anecdata, thank you for suggesting safemode.py
. I have created the following safemode.py
script and the devices I am testing have now been up for nearly 3 days. In those three days I have detected at least 4 crashes into safe mode, but the device has reset itself and continued on with the task.
import microcontroller
microcontroller.reset()
I would love for the wifi tools to be more stable, but this workaround at least keeps us up and on the network. Thank you!
I managed to hit "Hard fault: memory access or instruction error." after only a few minutes playing with the httpserver examples. I dont have more details at this time, just that I was using the pico w.
CircuitPython version
Code/REPL
Behavior
NeoPixel on board flashing three times every second or so.
Description
I left this code (pretty much just sample code) running on the board overnight while attached to my computer via USB. I was able to visit the website a few times (just going to root). But in the morning I found the board in safe mode with this message on the serial panel of mu.
Additional information
I have no idea if the httpserver just crashed after some period of time or if the Mac did something to kill the attached board.
Generally, how long and adafruit_httpserver servers run without cycling the board? If the board does need to be reset every now and then for stability, how often do you recommend doing that?