circuitpython: Copying multiple larger files can hang the copy if autoreload is on
First reported by @theacodes. Considerable discord discussion starting about 7pm ET 2021-1-12 in #circuitpython
Seems to happen fairly often (though not always) on SAMD21. Not sure if it happens on SAMD51. Not tried on other boards.
Example, copying to a Metro M0 Express running near the tip of main
. First erase the filesystem. Then, do not enter the REPL, but copy multiple larger files, e.g. like this set:
32278 Aug 29 2018 hit.wav
89134 Aug 29 2018 idle.wav
61164 Aug 29 2018 off.wav
75820 Aug 29 2018 on.wav
43438 Aug 29 2018 swing.wav
For me, one out of two times this caused the copy to hang.
@theacodes reports that a workaround is to copy one file at a time or to enter the REPL, so that auto-reload is not happening, and then copy.
This problem was not evident to @theacodes on 5.3.1.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 22 (15 by maintainers)
Confirming workaround: suspending autoreload through
supervisor.disable_autoreload()
or entering the REPL allows files to be copied without issue.This was discovered while programming Big Honking Buttons. The factory setup script copies a set of files to the device - one set is the following WAV files:
These in particular trigger the issue and would cause writes to the device to hang. It seems BHB’s library code accessing the filesystem at startup may contribute to triggering the issue more often as well.
As a workaround, we are forcing the device into the REPL before copying files:
With that workaround, we can program devices consistently without hanging:
@hathach Make sure and read the discussion on #4075 too.
thanks @dhalbert , I will take a break from rp2040 and switch to troubleshoot this tomorrow. There are a few of RP2040 usb issues (usbnet, webusb etc…) though those will probably take time since I will need to go through datasheet reading. Will ping you if I could find out anything.