realm-js
realm-js copied to clipboard
Realm lock threads with two bundle applications
I have two bundles running simultaneously in the react-native, having the following structure:
- RCTRootView
- UIView
- RCTRootView
- UIView
When this view structure is applied, realm starts the new thread successfully in the first RCTRootView. When the second thread will start with the second RCTRootView, the code that checks if the thread is finished goes into loops, locking the main thread and blocking the bundle loading.
It has been verified that the code that is causing this problem is in the class: From issue #1065 implementation. RealmReact.mm - 275 until 285 - below:
void _initializeOnJSThread(JSContextRefExtractor jsContextExtractor) {
// Make sure the previous JS thread is completely finished before continuing.
static __weak NSThread *s_currentJSThread;
while (s_currentJSThread && !s_currentJSThread.finished) {
[NSThread sleepForTimeInterval:0.1];
}
s_currentJSThread = [NSThread currentThread];
// Close all cached Realms from the previous JS thread.
realm::_impl::RealmCoordinator::clear_all_caches();
RJSInitializeInContext(jsContextExtractor());
}
Version of Realm and Tooling
- Realm JS SDK Version: 1.10.0
- React Nattive: 0.41.2
- Client OS & Version: Mac OS 10.12.6
@gutoglup Thanks for reporting.
Same problem here. Do you know the last version which this problem doesn't occur? This is blocking our development and we can't rollback to versions before 1.9.0 cause we need the backlink feature too. Thanks in advance.
Realm JS SDK Version: 1.10.0
React Native: 0.44.0
Client OS & Version: Mac OS 10.12.4
@gutoglup @jpsslink Currently we support only one instance. We will consider multiple instances as a future enhancement.
@kneth, i know that you treated this issue as a future enhancement, but we tested running realm and opening two bundles on Android and this behavior didn't occur, it only happens on iOS.
Was the feature of running more than one instance already implemented, since it works on Android? If yes, couldn't it really be a bug on iOS?
Again, thanks in advance.
@jpsslink the difference in behavior between iOS and Android is due to the way Realm plugs into React Native on those platforms. It's only incidental that using Realm in two or more bundles in the same applications works on Android - it's not something we officially support and test for.
Same problem here.
Same problem.
@kneth I also want to support this thread. Without it, it's impossible difficult to use realm on my app. We have multiples react native bundle on my app. Many guys that are not creating an app from scratch are on the same scenario.
Same problem.
Any update on this?
Sam problem
Any update on this?
Sam problem
@gutoglup @jpsslink Currently we support only one instance. We will consider multiple instances as a future enhancement.
Hello, does it now support multiple instances?