Skip to content

ESP32 supervisor.reload() does not disconnect user-connected wifi #9177

Open
@bill88t

Description

@bill88t

CircuitPython version

Adafruit CircuitPython 9.0.0-beta.0-52-g6c1e34e957 on 2024-02-17; M5Stack Timer Camera X with ESP32

Code/REPL

Adafruit CircuitPython 9.0.0-beta.0-52-g6c1e34e957 on 2024-02-17; M5Stack Timer Camera X with ESP32
>>> import wifi
>>> wifi.radio.connected
False
>>> wifi.radio.connect("Lunchbox", "[REDACTED]")
>>> wifi.radio.connected
True
>>> # I pressed Ctrl + D here.
soft reboot

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
The `microcontroller` module was used to boot into safe mode.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.0.0-beta.0-52-g6c1e34e957 on 2024-02-17; M5Stack Timer Camera X with ESP32
>>> import wifi
>>> wifi.radio.connected
False
>>> wifi.radio.connect("Lunchbox", "[REDACTED]")
>>> wifi.radio.connected
True
>>> import supervisor
>>> supervisor.reload()
soft reboot

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
The `microcontroller` module was used to boot into safe mode.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.0.0-beta.0-52-g6c1e34e957 on 2024-02-17; M5Stack Timer Camera X with ESP32
>>> import wifi
>>> wifi.radio.connected
True
>>>

Behavior

Wifi should have been disconnected, it was not.
This is an issue because the socket binds are not cleared and the code fails with address in use errors.

Description

This only happens on plain ESP32 as far as I can tell. I can't repro on s2.

Additional information

This assumes no wifi auto-connect credentials are installed.
I used safemode just cause it won't run my code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions