realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

Realm is already open in another context on this thread. #473

Closed joshuapinter closed 7 years ago

joshuapinter commented 7 years ago

This message just started appearing. Sometimes refreshing the simulator will fix it but other times I have to quit the simulator and launch it again.

Can you shed some light on what this error is and how to go about preventing it?

Thanks.

screenshot 2016-06-06 08 14 59

appden commented 7 years ago

Just checking, are you also accessing the Realm in native code with Realm Cocoa? Either way, I'd also like to know what versions of React Native and Realm you're using. Thanks!

joshuapinter commented 7 years ago

Hey @appden. I'm using Realm.js 0.13.2 on React Native master.

The only thing I can think of after looking a little deeper is that I've got a RealmInit.js file where I have the schema files and init the Realm database. I then require that in all my pages with:

var Realm = require('./RealmInit');

Again, this only started happening without any real code changes, just upgrading Realm for 0.12.0 to 0.13.2 and React Native from 0.24 to master.

Thanks for your help!

dlupu commented 7 years ago

Hello,

Having the same issue here. The issue appears when refreshing in the Ios Simulator

sarovin commented 7 years ago

me too

EngineerDiab commented 7 years ago

This happens when debugging JS remotely. Simply refresh your google chrome page that has the debugger window open and refresh simulator and all should work as expected.

joshuapinter commented 7 years ago

@EngineerDiab That doesn't fix it.

EngineerDiab commented 7 years ago

@joshuapinter Try uninstalling the application from the simulator and rebuilding. Also close anything that could be using the .realm file such as realm browser.

joshuapinter commented 7 years ago

@EngineerDiab You're right about the remote JS debugging, though. If I stop Remote JS Debugging the issue no longer occurs.

I'll try the delete and rebuild here in a second.

EngineerDiab commented 7 years ago

@joshuapinter It happens every so often on my end. Usually refreshing the chrome window with the debugger in it and refreshing the app does the trick

joshuapinter commented 7 years ago

@EngineerDiab Deleting the app and reinstalling it on the simulator doesn't fix it.

joshuapinter commented 7 years ago

If it was just once in a while I could live with quitting the simulator and starting it up again but it's happening 80% of the time now and is disruptive to my productivity.

I'd like to figure out why it's happening so we can find out a proper solution.

EngineerDiab commented 7 years ago

@joshuapinter that would be the best option. At the moment, the quickest solution is to cmd/ctrl + r debugger window, then cmd/ctrl + r simulator.

appden commented 7 years ago

I was able to reproduce this in Chrome debug mode. I will get this fixed. Thanks for reporting this everyone!

joshuapinter commented 7 years ago

Thanks @appden!

davepack commented 7 years ago

While waiting for the bug to be fixed, closing and stopping the app in the simulator (hit cmd+shift+h twice rapidly to bring up the app switcher and swiping the app away), then opening the app again solves the issue for me. I have to do this every time instead of refreshing, but I at least haven't had to restart the simulator or reinstall the app every time I want to refresh.

appden commented 7 years ago

I believe that turn off Chrome debug mode then back on again should also effectively workaround this issue.

meodemsao commented 7 years ago

i have the same issue, when i refresh again and insert data then i select data from realm's db object is undefine

aestrro commented 7 years ago

Same issue here.

alazier commented 7 years ago

Can any of you provide a simple app or code snippet that reproduces the problem? We would like to get this resolved asap and once we understand exactly what is going on which should be able to get a fix out pretty quickly.

aestrro commented 7 years ago

Well of course! I'll spend some time this evening getting this set-up.

joshuapinter commented 7 years ago

@alazier It sounded like @appden was able to reproduce the problem as well.

alazier commented 7 years ago

@joshuapinter you are right - I thought I was commenting on the change events issue. We have a fix for this one incoming soon. Hope to do a release today.

appden commented 7 years ago

Hey everyone, we released 0.14.0-rc. We're really hoping you'll try it out and let us know that this issue is fixed. Thanks!

johanmic commented 7 years ago

@appden been testing with 0.14.0-rc today and have not encountered this error again

joshuapinter commented 7 years ago

Double confirmation, does not happen with 0.14.0-rc. Thanks for fixing that!

👍

appden commented 7 years ago

Thanks everyone for the confirmation that this is fixed in the RC! We'll do a final release very soon. 🎊

sarovin commented 7 years ago

@appden Can you publish the RC version on NPM?

appden commented 7 years ago

Hey everyone, I just published the official 0.14.0 release, so please update to that. 🎉

dccarmo commented 7 years ago

We're still seeing this on 0.15.0: pasted image at 2016_11_28 11_40 am

Reloading the app usually fixes it, so we're not too worried, but it'd be good to know if it's something in our code or not.

alazier commented 7 years ago

@dccarmo this looks like a bug on our side and may only be an issue when using chrome debugging. Will look into it.

AllenHK commented 7 years ago

Same issue on version 0.15.0.

RyGuyM commented 7 years ago

Upgraded to react-native@0.39.1 and it seemed to resolve the issue for me. Previously I was on react-native@0.36.0 and it was an issue there.

mschipperheyn commented 7 years ago

Still have this on RN 0.39.1

bdash commented 7 years ago

Reopening as this won't be addressed until realm-js updates to a version of the object store that includes realm/realm-object-store#297.

mschipperheyn commented 7 years ago

Any eta on that?

JJMoon commented 7 years ago

Same problem. None of those methods above solves. I upgraded from Realm 1.0.0 React Native 0.40 to Realm 1.2.0, RN 0.42.3