Error while restoring state in react-native
See original GitHub issueI am using this library to persist redux store to allow for offline operations in my mobile application developed using react-native. Kudos on creating this awesome library. I was able to setup an offline layer in my application fairly easily. Lately, I keep getting this error after I refresh the app a few times
[
tid:com.facebook.react.JavaScript] 'Error restoring data for key:', 'contacts', { [Error: Failed to read storage file.Error Domain=NSCocoaErrorDomain Code=256 "(null)" UserInfo={NSFilePath=/Users/abc/Library/Developer/CoreSimulator/Devices/1BC0FBB2-F8CD-4972-9C33-15D7FB969B38/data/Containers/Data/Application/5DF58B17-541B-4B67-8AE3-D015EB5B757F/Documents/RCTAsyncLocalStorage_V1/90eb5e54838e5b2f33b011f232b016dd, NSUnderlyingError=0x7f8c2f2c33c0 {Error Domain=NSPOSIXErrorDomain Code=24 "Too many open files"}}]
line: 61916,
column: 18,
sourceURL: 'http://localhost:8081/index.ios.bundle?platform=ios&dev=true',
key: 'reduxPersist:contacts' }
Does this error have something to do with this library? Could this be a bug in the AsyncStorage adapter where files are not closed after persisting?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
redux-persist/getStoredState: Error restoring data for key: xxxxx
redux-persist has been working perfectly for me with smaller size state trees, but trying to use it on bigger ones I'm running into...
Read more >Preserving and Resetting State - React Docs
React keeps track of which state belongs to which component based on their place in the UI tree. You can control when to...
Read more >State and Jetpack Compose | Android Developers
On this page; State and composition; State in composables; Other supported types of state. Stateful versus stateless. State hoisting; Restoring state in ...
Read more >ignite-cli - npm
Infinite Red's hottest boilerplate for React Native. ... MobX-React-Lite; TypeScript; AsyncStorage (integrated with MST for restoring state) ...
Read more >State persistence | React Navigation
import AsyncStorage from '@react-native-async-storage/async-storage'; ... Only restore state if there's no deep link and we're not on web
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This hasn’t been responded to in a long while, so I’m going to mark it as stale. Please feel free to continue the conversation and I’ll reopen.
@rt2zz Thanks for responding. I am using
firebaseas the backend for thereact-nativeapplication. So, it is possible that I may also have similar websocket problem, although I am not sure if I can really control the creation and closing of websockets byfirebase. I see thatAsyncStorageis backed by json files. I guess I should first check whenAsyncStoragecloses the files after a read/write. I am thinkingAsyncStoragemust be caching the open file handles for quick read/write access and we probably end up writing in separate json files after each persist causing the too many files open error.I have been thinking about adding an alternate storage backend backed by SQLite or Realm if I don’t get to fix the problems as you have suggested.