Repository navigation
Hard fault crash when using HTTPServer:ESP32-C3 #9735
Description
Activity
Is this a duplicate of #9460 ?
@c--- The test program above generates continuous
ServerStoppedexceptions. This is more easily seen if you dowhile True: try: server.poll() except Exception as e: print(type(e))
to print the type rather than the string form of the exception.
You do need a
server.start(). However, in your original test program, you had:server.start("0.0.0.0", 80)
If I add that, I do indeed get a hard crash. But instead of using 0.0.0., use this:
server.start(str(wifi.radio.ipv4_address))
In other words, for now, you need to specify the IP address specifically;
"0.0.0.0"doesn't work. That's a bug we should fix.
You can also useserver.serve_forever(...), which does the.start()and the.poll()loop for you.- changed the title
[-]crash when using HTTPServer[/-][+]crash when using HTTPServer and 0.0.0.0 as IP address[/+]on Oct 20, 2024 What are the implications of this discovery for #9460 which was thought to be the same (or at least related) bug. That does not use the 0.0.0.0 address.
What are the implications of this discovery for #9460 which was thought to be the same (or at least related) bug. That does not use the 0.0.0.0 address.
I don't think these are the same after all, after looking into it further.
- changed the title
[-]crash when using HTTPServer and 0.0.0.0 as IP address[/-][+]Hard fault crash when using HTTPServer[/+]on Oct 22, 2024 - changed the title
[-]Hard fault crash when using HTTPServer[/-][+]Hard fault crash when using HTTPServer:ESP32-C3[/+]on Oct 22, 2024 Reproduced, but only on ESP32-C3. Test program:
import wifi import socketpool from adafruit_httpserver import Server import time time.sleep(5) print("IP addr", wifi.radio.ipv4_address) pool = socketpool.SocketPool(wifi.radio) server = Server(pool, debug=False) # port 80 will get EADDRINUSE due to web workflow # Either IP adddress will cause a crash eventually. server.start("0.0.0.0", 8000) #server.start(str(wifi.radio.ipv4_address), 8000) while True: try: server.poll() except Exception as e: print(type(e))
Either
servert.start()can cause a crash: the wildcard IP address or the actual IP address don't matter. It takes around 1-5 minutes to restart in safe mode, though I have seen it run longer. No interaction with the HTTP server is needed. I simply restart code.py and wait.I have reproduced this only on a QT Py ESP32-C3. I cannot reproduce on a QT ESP32-S3, with no PSRAM. I was hoping it might have been a storage leak.
I'm closing this in favor of #9749. There are several red herrings above, which are irrelevant to the actual issue.
EDIT: closed in favor of #9749
Originally posted by @c--- in #9173 (comment)
Adafruit CircuitPython 9.2.0-beta.1 on 2024-10-11; Maker Go ESP32C3 Supermini with ESP32-C3As far as I can tell,
server.poll()might be the cause.Currently using the following code.py that still crashes: