I added redux-persist to a React Native app 3 months ago, and started getting frequent but irregular crashes when running on iOS devices (all iOS 11). The problem does not occur when running on the simulator.
According to sentry.io, the error is:
EXC_BREAKPOINT main
fatalException 6, Code 2390738480, Subcode 8
There are more details here: https://stackoverflow.com/questions/48558390/crashes-when-using-redux-persist-on-react-native-on-ios.
The crashing stops when I remove redux-persist, so it seems like this is definitely the cause, but I'm at a loss as to how I can debug it.
that is concerning. It could certainly be size related - possibly a bug in rn.
Have you tried alternative storage adapters, e.g. https://github.com/robwalkerco/redux-persist-filesystem-storage
For context I have been running redux persist in production for over a year (also with sentry) and have not seen these crashes. Can you log or estimate how large your storage is in a long running production install?
That's a good idea - I'm now testing a new build using redux-persist-filesystem-storage. No issues so far, but I'll keep using it and report back.
The storage is not really that huge: the RCTAsyncLocalStorage_V1 directory on an instance that has shown this crashing behaviour contains a file that is 35MB.
Occurrences of this bug have been dramatically reduced since I started using the filesystem adapter, and based on conversations with the author of that, I'm ready to assume that this is an out of memory error based on a reducer with too much data. It looks like the native implementation of Async Storage crashes when preparing the string to write to file if the JSON is too large.
Most helpful comment
that is concerning. It could certainly be size related - possibly a bug in rn.
Have you tried alternative storage adapters, e.g. https://github.com/robwalkerco/redux-persist-filesystem-storage
For context I have been running redux persist in production for over a year (also with sentry) and have not seen these crashes. Can you log or estimate how large your storage is in a long running production install?