CommCare Android can enter an error state with the message "Storage is Corrupt :/" (see image at bottom). Basically this happens when the app install that's currently on the phone enters an inconsistent state that we can't correct. There are three causes of this
1) The app's storage files have been manually changed/modified
Some of CommCare's files non-userdata files are stored on the phone in an area where external apps can delete them. This used to be a rampant problem on Android phones which used the SD card to store certain files (this was common before android 2.2)
2) The phone's storage layer has corrupted the files stored to the device
This is a problem that we've seen on certain devices that we've been investigating the prevalence of to identify whether it's real. It's hard for us to differentiate between certain types of hardware failures due to the way we encrypt data (since we write user files in an encrypted way, minor block-level corruption of files that would be easy to spot in un-encrypted data simply results in a pseudo-random blob looking equally pseudo-random blob for us).
The kinds of block storage used by mobile devices have physical limitations on the number of reads and writes they can perform. On good Flash storage these limits are unlikely to be hit, but on certain counterfeit storage chips it is a common problem for data reads and writes to fail silently.
We don't believe this to be a common problem outside of Counterfeit SD cards (and most files on most phones are stored on the phone's storage, not on an external SD card), but it has come up in the past rarely.
3) There is a bug in CommCare's code that is resulting in corrupted files
It's possible that CommCare is writing an invalid app structure to the phone's storage due to an unforseen bug in the code.
The only time this kind of bug could occur that would result in Recovery Mode being triggered would be immediately after some sort of remote update that resulted in the phone not having a fully installed and consistent version of your app. This would not be expected, however, to cause any problems in submitting unsent data to the server.
Reporting Storage Corrupt errors
Please submit a bug report every time you see something occur! Some helpful things for us to know to differentiate between these use cases
- What version of CommCare you are using - So we know whether it's possible that you are triggering an older bug
- What devices are in use: This helps us disambiguate whether the issue might be related to "external storage" on older android phones and also the likelihood that there might be any hardware problems.
- Whether there was a specific circumstance that seemed to trigger the issues. Are you frequently using remote updates for the app? Do you know whether the issues appeared after some critical event?
- How widespread is the issue? Do certain users seem to have the problem over and over, or is it randomly distributed between users?
- Can you replicate the problem? If so we can help work through it very quickly.