-
Notifications
You must be signed in to change notification settings - Fork 1.3k
flush filesystem before resetting heap #1649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tried on feather_nrf52840 - same results -- reboots to safe mode -- FS erased |
@jerryneedell Thanks for testing. Your test is not running code.py; I'm thinking I need to do the same |
@jerryneedell Added another flush, and I believe I tested your scenario successfully. |
I just tried your commit @dhalbert and it already is appearing to function better (i.e. no crashes yet) on the Feather M4 Express. |
Would this have affected 3.x too? |
works great on the feather_nrf52840! works on pyportal as well!! |
@kevinjwalters it's possible it was a latent issue in 3.x, but it might have been ameliorated by different timing. There is a ram flash cache in 3.x as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been playing with the Feather M4 Express for a while with this change and it's working much better. Looks like I don't have write access, so my approval doesn't mean much.
That didn't do it. |
I tried this PR on my PCA10059 - It has been awhile since I used it and I don't recall the state I left it in. After loading the new image, I found that my FS was corrupted, but then after erasing and reloading the FS (using storage.erase_filesystem()), it has been worked normally -- with a BLE Uart test and Eddystone beacon test. |
Hmmm -- Update -- PCA10059 wiped itself -- not sure when or why but I first found that I could not run a script I had just loaded, and os.listdir() just showed a lot of 00's. I did a hard RESET and it booted OK, but all the files were gone. added: Is there a difference in how the PCA10059 handles this since it does not have an SPI Flash for the FS? |
This PR is a huge improvement over Beta4 in terms of stability for the FS for most boards. While the pca10059 appears to be an exception there may be a separate issue going on there. In my experience, the PyPortal and feather_nrf5840 are working well and were extremely frustrating with Beta4. |
I tested the pca10059 with a simple main.py, that doesn't use any external libs. With the pca10056, it's completely different. It seems that there are still some timing problems. |
The difference here is that the PCA10059 uses internal flash for CIRCUITPY, and the PCA10056 uses external. So there's probably a different bug related to that. There's code to use the SoftDevice internal flash writing routines when the SoftDevice is enabled, but clearly there's still some issue. I will look at that. |
I think I'm going to release a beta 5 immediately with just this fix, since beta 4 is too broken for most people to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested on pyportal, feather_nrf52840 and intsybitsy_m4
Recommend releasing even with remaining issues on pca10059/pca10056
Does this post need an edit or a reply on when beta 4 should or should not be used? https://forums.adafruit.com/viewtopic.php?f=60&t=149034 |
If the bug affects the pca10056, then it should also affect the feather_nrf52840, as both are nRF52840 with external flash. Unless it's a SPI timing issue, and the flash chips behave differently. |
so far, I have found the feather_nrf52840 and a particle_argon to both behave well with this PR. I am just doing "normal" use -- running code and copying files to the FS then issuing soft reboot. I have not had any problems. One related observation - not new but still occasionally occurs. |
@jerryneedell Would you mind trying this code?
This code wipes itself on the pca10059, but runs on the pca10056, so I guess it'll also run on the feather_nrf52840. |
@uhrheber I made a modified version since the feather_nrf52840 does not have the same LEDs - I just use 1 LED
|
it is also running OK on a feather_nrf52840 |
@uhrheber and @jerryneedell could you open a new issue for the PCA10059 issue, so we can track it? Thanks. |
I think this fixes #1643.
There's a RAM filesystem cache on the heap, in some circumstances, and it was not flushed and discarded before the heap was reset.
Also fixed minor problem in display background task, setting reload exception after it was already set.