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

Realm JS causes app crash in background when physical iOS device with PIN is locked #3162

Closed
gboyegadada opened this issue Aug 26, 2020 · 2 comments

Comments

@gboyegadada
Copy link

gboyegadada commented Aug 26, 2020

Goals

No crashes while using realm js on physical iOS devices.

Expected Results

Realm queries should not crash when physical iOS device is locked with PIN.

Actual Results

App crashes when in background and phone is locked.

Thread 4 name:
Thread 4 Crashed:
0   libsystem_platform.dylib      	0x000000019d119e00 _platform_memcmp + 16
1   MyApp                    	0x0000000104e112f0 realm::ArrayStringShort::find_first(realm::StringData, unsigned long, unsigned long) const + 304
2   MyApp                    	0x0000000104e2b6d0 realm::Group::do_get_table(realm::StringData) + 48
3   MyApp                     	0x0000000104e28884 realm::Group::get_table(realm::StringData) + 24
4   MyApp                     	0x0000000104cb8f88 0x1049b0000 + 3182472 (object_store.cpp:219)
5   MyApp                     	0x0000000104ca2404 0x1049b0000 + 3089412 (js_results.hpp:153)
6   MyApp                    	0x0000000104ca1f08 0x1049b0000 + 3088136 (js_realm.hpp:921)
7   MyApp                    	0x0000000104c9d958 0x1049b0000 + 3070296 (jsc_class.hpp:985)
8   JavaScriptCore                	0x00000001ac54e85c long long JSC::APICallbackFunction::call<JSC::JSCallbackFunction>(JSC::JSGlobalObject*, JSC::CallFrame*) + 420 (APICallbackFunction.h:63)

Steps to Reproduce

Code Sample

Version of Realm and Tooling

  • Realm JS SDK Version: ^6.0.4
  • Node or React Native: RN: v0.63.2
  • Client OS & Version: iOS 13.6.1
  • Which debugger for React Native: None on physical device
@steffenagger
Copy link
Contributor

@gboyegadada thanks for the report, I've added it to our backlog.

It's unfortunately not as trivial as updating the docs when it come to RN - initial thoughts are that a config parameter needs to be added for Realm, and use it to ensure the NSFileProtection level behind the scenes (as described in your linked documentation).

@gboyegadada
Copy link
Author

@steffenagger A little update: I wrote a small module to help me subscribe to the
UIApplicationProtectedDataWillBecomeUnavailable and UIApplicationProtectedDataDidBecomeAvailable notifications in iOS (turns out that it's relatively easy to send event notifications from Objective C to react native with some help from the RN docs and a tutorial (I'm completely new to Objective C !)

So right now, I basically suspend my db related tasks when the device is locked and resume when unlocked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants