← index #18993Issue #17027
Off-topic · high · value 1.154
QUERY · ISSUE

ESP32: Microdot web framework does not work above MicroPython version 1.21.0

openby IhorNehrutsaopened 2026-03-25updated 2026-03-26
bugport-esp32

Port, board and/or hardware

ESP32 port; Generic ESP32 module ESP-WROOM-32

MicroPython version

MicroPython v1.21.0 on 2023-10-05; Generic ESP32 module with ESP32

Reproduction

boot.py

# Replace the following with your WIFI Credentials
SSID = "SSID"
SSI_PASSWORD = "SSI_PASSWORD"

def do_connect():
    import network
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
        print('Connecting to network...')
        sta_if.active(True)
        sta_if.connect(SSID, SSI_PASSWORD)
        while not sta_if.isconnected():
            pass
    print('Connected! Network config:', sta_if.ifconfig())
    
do_connect()

copy https://github.com/miguelgrinberg/microdot/blob/main/src/microdot/microdot.py to the ESP32 board

run microdot_test.py

from microdot import Microdot

app = Microdot()

@app.route('/')
def index(request):
    return 'Hello, world!'

if __name__ == '__main__':
    app.run(debug=True)

Expected behaviour

With MicroPython v1.21.0

<img width="941" height="728" alt="Image" src="https://github.com/user-attachments/assets/c3408b35-2f23-4cf7-9141-a73654193358" />
<img width="1312" height="332" alt="Image" src="https://github.com/user-attachments/assets/e156d18f-3efc-4697-b318-b8d30e3d6aca" />

Observed behaviour

With MicroPython v1.22.0 on 2023-12-27; Generic ESP32 module with ESP32

<img width="1292" height="377" alt="Image" src="https://github.com/user-attachments/assets/7aa1ffef-e538-44d4-9424-e31b60fce2ec" />

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Wifi Unknown Error 0x0101

closedby robtinkersopened 2025-03-28updated 2026-03-16
bugport-esp32

Port, board and/or hardware

esp32

MicroPython version

MicroPython v1.24.1 on 2024-11-29; Generic ESP32 module with ESP32

Reproduction

import gc, machine, network, sys, time

from microdot import Microdot # https://raw.githubusercontent.com/miguelgrinberg/microdot/refs/heads/main/src/microdot/microdot.py

print("FREE:", gc.mem_free())

gc.collect()

DATA=bytearray(10_000)

print("FREE:", gc.mem_free())

try:
    
    ap_config = {"essid":"testing!", "password":"", "authmode":network.AUTH_OPEN}
    ap_if = network.WLAN(network.AP_IF)
    ap_if.active(True)
    ap_if.config(**ap_config)
    print("Active", repr(ap_if.ifconfig()))
    
    while True:
        print(time.time(), repr(ap_if.status("stations")))
        time.sleep(1)

except KeyboardInterrupt:
    pass
except Exception as e:
    sys.print_exception(e)
machine.reset()

Expected behaviour

Not Wifi Unknown Error 0x0101

Observed behaviour

FREE: 117424
FREE: 144880
Traceback (most recent call last):
  File "<stdin>", line 16, in <module>
RuntimeError: Wifi Unknown Error 0x0101
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4892
ho 0 tail 12 room 4
load:0x40078000,len:14896
load:0x40080400,len:4
load:0x40080404,len:3372
entry 0x400805b0
MicroPython v1.24.1 on 2024-11-29; Generic ESP32 module with ESP32
Type "help()" for more information.

Additional Information

Note that the bug isn't microdot-specific, and might simply be triggered by large amounts of code. I have had similar issues with other libraries which don't use any external modules (i.e. no asyncio, network, socket).

The DATA size that triggers the bug will vary with the exact imports and whether gc.collect() is called.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied