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
Interprocess support for encrypted Realms #1477
Comments
Are you using same Realm in different processes? @KynoYang Multi-processes for java is not supported yet... |
@KynoYang is still seeing this issue http://crashes.to/s/afa05a92642 |
Hi. I encountered this issue too cause of using firebase. It causes by adding plugin 'com.google.gms.google-services' for automatically integrating firebase sdk. If I removed that plugin or remove realm encryption, everything is ok. Any suggesstion? Thanks. |
@phamducgiam Do you have something like |
@beeender: I just found out. It's because firebase crash automatically create a background process for reporting. I just disable firebase crash for now and will fix it later. |
Here's my observation, reposted here as instructed in #3203
Crashlytics reports this kind of crash for around 1,5% of about 50k users so far and I can't figure out what causes it, neither reproduce it on any of our test devices or emulator. Things to consider:
Version of Realm and toolingRealm version(s): 1.1.0 |
@biftekman A hypothesis is there is a bug with some devices's package manager. When installing and running the new version of APK, the old process has not been killed yet -- This would trigger your issue and #2928 .
And I think above fact supports our hypothesis well. We made some workaround try to solve #2928 -- delay some time if we see there is another process alive and opening the Realm file, but from feedback, it doesn't help too much :( |
@beeender does the crash then kill the old process as well? Meaning that reopening the app afterwards would occur normally? |
@biftekman It will only kill the process which throws this exception. But from the exception message:
Interesting thing is we can see it is actually the old process throws the exception ( Can you see in the crashlytics backend that the exception is reported from the old version or the new version? (Although I am not quite sure how does crashlytics get the version information. If it gets the information based on the apk installed on the system, then it will always reports the new version i think?) |
@beeender
But that should not indicate that current process id is either "newer" or "older". Although PIDs are allocated on a sequential basis, when max value is reached, allocations start from 0 again. Regarding Crashlytics reporting: as it is in our case initialised inside Application class which is started by a process under the same package, it will report a crash from whatever process causes it. Since we always see crash results matching the newer versions, I'd guess the new process throws the exception. |
Do you have any logic to restart a service in the apk? I tried something like |
The only time the app starts a service is when I bind But in any case, creating another process during runtime should crash the app in our situation anyway (since Realm instance is obtained in application class), which never happens. So that shouldn't prove anything. Regarding your original hypothesis, did you manage to reproduce the "not-killed process on update" before? |
We tried a lot, but never reproduce "not-killed process on update" :( But from the crash log, there are two processes for a same app are running in the system which should not ever happen ... We tried a lot but cannot reproduce it on any of our devices ... |
Is a following workaround currently possible for our situation: If not, solution to this is still pretty straightforward: |
Hi, Realm Version: 6.0.1, Still crash...
|
After update have this issue for a while. But can't reproduce (v6.0.2) |
Issue is still ongoing with v6.1.0:
Occurs repeatedly (on subsequent app starts) for the same user (but several users are impacted). Might be interesting: I have subsequent reports (that may very well belong to the same user), where the "opened by pid" stays constant, and the "current pid" changes. |
I see some users recommend moving |
Don't move |
Thanks for the clarification. I don't have |
Does |
Not that I know of 🤔 |
I am seeing the same issue. I too cannot reproduce this on my current devices. But Crashlytics indicates this happens on Samsung A20s and I just got it now. So I will attempt to update the application that crashes in a couple of ways. Perhaps it will reproduce. Any way, in Application onCreate() I init Realm with Realm.init(). Which as mentioned here is fine. First I call this in Application onCreate():
And here is RealmUtils.get().getEncryptedInstance():
I suspect Realm.getInstance(oldConfig) is like Realm.getDefaultInstance ? Could this be the issue? Thank you Edit 1: Edit 2:
There is a stack trace that starts from a certain method that returns an instance of a Realm DB and then:
Edit 3:
|
Could calling Realm.compactRealm() during Realm init cause this issue? I am calling that during Application onCreate(). I'll try to change it to compactOnLaunch() in the RealmConfiguration builder. |
To sum up this thread:
What I can't seem to find is any recommendation on how to minimize this issue. One that comes to mind is to minimize the amount of time between when a process calls |
Unfortunately, we don't have a solution for when the OS instantiates twice the app because of an update. To minimize the impact you could catch the
|
I hear what can help is checking in a BaseActivity if |
We're observing exactly the same in our project. Most of the issues are coming from Samsung S10+, on that device we had a spike of 286 crashes affecting 4 users within 4 days. For example, there're more than 70 crashes with the same opened pid 20925:
One question, would it be possible to include in the exception message not only a PID but also a process name? |
@volo-droid what is your Realm version, and what Realm version created the Realm file? |
@Zhuinden The current version is 7.0.2, but I'm not sure what version was used to create a Realm file. The whole Realm thing is encapsulated in an in-house SDK we use, I'd have to check with its maintainers. In the git blame I can see the following Realm versions 5.4.1 -> 6.1.0 -> 7.0.2 |
I also see this issue popping up when it is time to upgrade our app and it is mostly Galaxy S10+ |
We also experience this exception on v7.0.8 |
Had this error on
After an app update through Play Market |
Is there any workaround? You said it's better to put |
@volo-droid you can get the other processName via:
Maybe this issue might happen not only during app-upgrade, but also when your app has a Worker do to some background work? |
I'm using realm 10.4.0 and this still happens. Always when the user migrates from a previous realm version |
Fixed by #7795 |
Realm version is 0.8.2, Android version is 4.4.2
Encrypted interprocess sharing is currently unsupported in io_realm_internal_SharedGroup.cpp line 115
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
at io.realm.internal.SharedGroup.(SharedGroup.java:60)
at io.realm.Realm.(Realm.java:207)
at io.realm.Realm.createAndValidate(Realm.java:597)
at io.realm.Realm.create(Realm.java:567)
at io.realm.Realm.getInstance(Realm.java:540)
Anyone know what it is?
The text was updated successfully, but these errors were encountered: