Skip to content

[Android] multiGet() hangs, app not responsive #634

Closed
@ecexplorer

Description

@ecexplorer

Current behavior

In our app, I call AsyncStorage.multiGet() on a key array with just two keys. Admittedly one of the keys is tied to a JSON string that when formatted, is 17000+ lines long. This is still under the overall 6MB limit.
When the call is made, it just hangs. No error is thrown, and if I use a callback, it is never called. The same data in iOS has no problem being fetched.
I can also tell that the data is there. That 17,000+ number comes from pulling the data directly on Android Studio using the database inspector. The data is being stored correctly.
If I request the same data using getItem(), then the request works without issue and I get the expected value back.
(See comments for a workaround)

Expected behavior

Calls to multiGet() don't hang, return the data expected.

Repro steps

  • Set two items in AsyncStorage, ensure one of those is LARGE.
  • Attempt to get both at once with a multiGet() request.
  • If the request hangs, this has been repeated.

Similar to source, if I make a Promise.all(keys.map(async (key) => [key, await AsyncStorage.getItem(key)]), I see the same hang. Android doesn't seem to like the multiple accesses to AsyncStorage/DB at once.

Environment

  • Platforms tested:
    • [ X] Android
    • iOS
    • macOS
    • Windows
  • AsyncStorage version: 1.15.5
  • Environment:
    System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 131.27 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
    Binaries:
    Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
    Yarn: Not Found
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
    Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
    SDKs:
    iOS SDK:
    Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK: Not Found
    IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
    Languages:
    Java: Not Found
    Python: 2.7.16 - /usr/bin/python
    npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.63.4 => 0.63.4
    react-native-macos: Not Found
    npmGlobalPackages:
    react-native: Not Found
  • Logs/Errors that may be relevant: I don't get any logs, errors, etc. I just hangs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatform: AndroidThis is Android specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions