Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Old settings are read after app reinstall #325

Closed
glenne opened this issue May 10, 2023 · 1 comment
Closed

[Bug] Old settings are read after app reinstall #325

glenne opened this issue May 10, 2023 · 1 comment

Comments

@glenne
Copy link

glenne commented May 10, 2023

Describe the bug
After uninstalling the app and reinstalling, it reads stale settings data.

To Reproduce
Steps to reproduce the behavior:

  1. Uninstall App, then Install the App
  2. Note that previous settings are read from MMKV. e.g. X=ABC
  3. Change setting X to XYZ
  4. Exit the app or even reboot the device. Do not uninstall.
  5. Start the App and note setting is X is still XYZ (good)
  6. Uninstall the App, then Install the App
  7. Note that settings restored have X=ABC (bad)

Where is this old setting coming from? Rebooting the device read back X=XYZ (good) but reinstalling reads back ABC (bad).

Expected behavior
After app reinstall, the setting for X should be the last set value (XYZ), not some prior value (ABC)

Screenshots
N/A

Platform Information:

  • OS: Android
  • React Native Version [e.g. 0.71.6]
  • Library Version [e.g. 0.9.1]

Additional context
Am using MMKV.getMapAsync and MMKV.setMapAsync. Init done with new MMKVLoader().initialize()

I attempted to enable logging and got the following trace. The files seem to magically appear when the app is started. If the app is uninstalled, where are the files coming from with old state?

05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV.cpp:165::initialize> version v1.2.13, page size 4096, arch arm64-v8a
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV.cpp:176::initialize> armv8 AES instructions is supported
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV.cpp:184::initialize> armv8 CRC32 instructions is supported
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV.cpp:207::initializeMMKV> root dir: /data/user/0/net.entazza.crewtimer/files/mmkv
05-10 17:08:29.854 26499 26914 I MMKV    : <MemoryFile.cpp:97::open> open fd[0x6f], /data/user/0/net.entazza.crewtimer/files/mmkv/mmkvIDStore
05-10 17:08:29.854 26499 26914 I MMKV    : <MemoryFile.cpp:97::open> open fd[0x73], /data/user/0/net.entazza.crewtimer/files/mmkv/mmkvIDStore.crc
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV_IO.cpp:81::loadFromFile> loading [mmkvIDStore] with 83 actual size, file size 4096, InterProcess 0, meta info version:3
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV_IO.cpp:86::loadFromFile> loading [mmkvIDStore] with crc 1774334605 sequence 1 version 3
05-10 17:08:29.854 26499 26914 I MMKV    : <MMKV_IO.cpp:130::loadFromFile> loaded [mmkvIDStore] with 2 key-values
05-10 17:08:29.856 26499 26914 I MMKV    : <MMKV.cpp:207::initializeMMKV> root dir: /data/user/0/net.entazza.crewtimer/files/mmkv
05-10 17:08:29.859 26499 26914 I MMKV    : <MemoryFile.cpp:97::open> open fd[0x74], /data/user/0/net.entazza.crewtimer/files/mmkv/default
05-10 17:08:29.859 26499 26914 I MMKV    : <MemoryFile.cpp:97::open> open fd[0x80], /data/user/0/net.entazza.crewtimer/files/mmkv/default.crc
05-10 17:08:29.859 26499 26914 I MMKV    : <MMKV_IO.cpp:81::loadFromFile> loading [default] with 52147 actual size, file size 131072, InterProcess 0, meta info version:3
05-10 17:08:29.859 26499 26914 I MMKV    : <MMKV_IO.cpp:86::loadFromFile> loading [default] with crc 3152578544 sequence 11 version 3
05-10 17:08:29.859 26499 26914 I MMKV    : <MMKV_IO.cpp:130::loadFromFile> loaded [default] with 8 key-values
@glenne
Copy link
Author

glenne commented May 11, 2023

Argh! Problem solved.

Somehow on this device Samsung Backup and Restore was enabled and it had cached an old state. When the app was reinstalled the old state was brought in with the app and react-native-mmkv-storage did it's job and read it in as it should. Disabling Samsung Backup and Restore returned all to expected behavior. If only these manufacturer apps could be easily uninstalled...

@glenne glenne closed this as completed May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant