Ctrl + D combined when _thread is in background crashes the Device
robi90 last edited by
When I try to do a soft reset over REPL, by pressing Ctrl+D, my LoPy4 just crashes. Ctrl+D works for soft reset, when my programm is not running (expl.: when safe booting). I tried a few things and think the crash happens when a _thread is running in the background.
The following is a minimal example, where at least for me, the LoPy4 always crashes on Ctrl+D:
import _thread import machine def new_thread(): while True: machine.sleep(1) _thread.start_new_thread(new_thread, ())
I'm running 1.19.0.b4 Firmware.
Hope there is a fix at some point. Thanks in advance.
robert-hh last edited by
@robi90 I misunderstood your first post, assuming a hard crash. I just tried your example and agree, that this is not good and must be fixed, because the device locks up in an unresponsive state.
I tried that with version 1.20.0.rc4.
The situation is a little bit better with Ctrl-F, because then the device falls at least back to safe boot, from which it can be restarted with machine.reset(). But only from the USB port. Using telnet is only possible then, if you use the default settings for WiFi.
robi90 last edited by robi90
@robert-hh well I mean, it is kinda frustrating right now. if you hit Ctrl+D (or apparently Ctrl+F as well), for whatever reason (I just accidently hit it because I'm used to closing ipython with it :D ), your board gets unreachable. For me this is a problem because I'm working remotely on it. So if the board becomes unresponisiv for whatever reason, I can't just hard reset by myself.
Considering the nature of the pycom platform with it's low power consumption and wide range of communication features, I guess a lot of people use it out in the field, with no easy way of hard resetting. So in my opinion we should try to minimize the possibility of requiring a hard reset. :)
An auto reset after crash would work for me aswell, but right now, I don't know if there is a way to do that.
Maybe fix is the wrong word. Let's call it firmware improvement :D
@robert-hh whilst not crucial, having it not clean up additional threads is just messy and likely to cause an issue somewhere else down the line.
Thanks, this is a known issue at the moment. The same will happen on Ctrl + F. only the main thread is currently stopped. Background threads will continue on.
A fix is being worked on. but I dont have any timeframe for completion.
robert-hh last edited by robert-hh
@robi90 Why should there be a fix? A soft reset is meant to stop all activities, but not to reset the hardware. A crash ends in a hard reset. In both cases you end up with the normal boot procedure.
The crash dump looks dramatic, bus is not.