react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.61k stars 459 forks source link

Failed to write manifest file.Error Domain=NSCocoaErrorDomain Code=640 "You can’t save the file “manifest.json” because the volume “Data” is out of space." #1043

Closed MaratowKyryl closed 4 months ago

MaratowKyryl commented 7 months ago

What happened?

I got this error logged in Sentry.

Failed to write manifest file.Error Domain=NSCocoaErrorDomain Code=640 "You can’t save the file “manifest.json” because the volume “Data” is out of space."

All of users have at least 100mb free memory.

I assume, that the problem is the size of manifest file reached the limit. But, I can't find any info about known limits of manifest.json file on ios and there is no information in documentation or elsewhere how to increase the size limit.

Version

1.19.3

What platforms are you seeing this issue on?

System Information

OS: macOS 14.1.1
    CPU: (8) arm64 Apple M1
    Memory: 74.42 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 6.12.0
    Watchman: 2023.11.20.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.14.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
react: 17.0.2 => 17.0.2 
    react-native: 0.67.5 => 0.67.5 

Steps to Reproduce

Run an application and save a lot of data on user login

krizzu commented 7 months ago

There's no limit for manifest file. It seems like there's not sufficient space to store app related data anymore. Here's the error you see https://developer.apple.com/documentation/foundation/1448136-nserror_codes/nsfilewriteoutofspaceerror

MaratowKyryl commented 7 months ago

There's no limit for manifest file. It seems like there's not sufficient space to store app related data anymore. Here's the error you see https://developer.apple.com/documentation/foundation/1448136-nserror_codes/nsfilewriteoutofspaceerror

I just checked and figured out that we use only around 750 bytes of data stored in AsyncStorage. Still cannot understand how it's possible to run out of space.

krizzu commented 7 months ago

It might be that users are low on total amount, hence the issue. For values larger than 1MB, AsyncStorages on iOS stores them in a separate file (for each item) - does your calculation cover this?

MaratowKyryl commented 7 months ago

It supposed to. I'm using this solution to calculate the size of all key-values from storage:

https://github.com/react-native-async-storage/async-storage/issues/336#issuecomment-1654434540

krizzu commented 7 months ago

I can't tell for sure it would show the total disk space used. I'm unable to tell why you got that error, but it is related to disk space available on device (not due to some limit of AsyncStorage)

github-actions[bot] commented 5 months ago

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.