I only experience the issue on ESP8266 modules, but after some time (many days, perhaps weeks).
MicroPython gets into a bad state.
I use MicroPython on that modules only remotely via "webrepl.html" in browser or "webrepl_client.py", no serial connection.
After some time login is difficult (needs retries), or a connected active session gets terminated by module reboot.
I am able to fix the issue using these steps:
- connect module to USB port
- screen /dev/ttyUSB3 115200
- import webrepl_setup, then choose to disable WebREPL and reboot
- after reconnect with screen, import webrepl_setup, choose enable, change password to that used before and reboot
- disconnect module from USB port
- now WebREPL can be used again for many days, perhaps weeks