-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 Swift - iOS 14 issue - there’s no crash, but saved info in database is not available #6843
Comments
have same issue |
@AuraNica Are you able to reproduce this on |
@AuraNica Are you running the application with the debugger active? I notice that my |
I've waited to release yesterday a version of our app with realm 5.4.8 and I was able to see today that some users are still facing the issue.
I could never see the issue with the debugger attached, only on the store version. Later edit: |
have the same setup and symptoms and any action that's using Realm when app is in background leads to this issue. Realm framework version: 5.4.1 - 5.4.8 |
I was able to see the error at realm init: But we don't have app groups or share extension in our app, is there anything else that could cause this issue? Do you have any idea what could have happened? |
Is there anyone from Realm team that could answer my question above? I'm trying to understand what is wrong in our app and how to fix or change that. We've updated our app to Realm 10.0.0, but the issue is still here affecting most of our users with iOS 14+ when they leave the app in the background for a long time (sometimes a few hours, sometimes a day). After we've updated to Realm 10.0.0 it started to reproduce on any version of the app, not just the one from store. So I can catch the error in my debugger - do you need any more details? What can I do to help you speed this process? Thank you. |
This is pointing at a problem with our workaround for iOS 14 no longer allowing us to use flock(). It sounds like in some case we think that the old process is still running when it isn't, which for unencrypted realms is mostly fine (it just stops us from doing some cleanup) but for encrypted realms isn't. A bad workaround for this is to delete the |
I'll give it a try, but I'm not sure what lock.fifo is, are you referring to this files?
|
@tgoyne are there any troubleshooting steps to identify place that breaks locks more precisely and probably help with a better understanding what's going on? Because in my case any action that moves application to background(switch app, minimize it, open notification center, etc) make realm database unusable on real device with iOS 14 and i couldn't understand why in my case it appears without time delays like in @AuraNica 's app. Update: maybe it is because my application is not doing any background work and application immediately is moved into suspended state. |
I spent some time digging into this today in the hopes of reproducing it without any luck. Some of the things I tried:
Unfortunately all of these seemed to work correctly. |
We released a new version with the fix from above, the errors with "interprocess sharing" were gone, but I saw new ones like this: "Realm file decryption failed". The only way to fix it was to remove the entire database file and try to init realm again...but this just doesn’t seem right. |
We ended up removing the encryption of the database, now we only encrypt the fields that we need in keychain. Not the best choice, but at some point in the future we will develop a watch app, so it was necessary for that, too. |
@AuraNica did you resolve this bug, my app have the same issue. Does the latest version of Realm (10.5.1) resolve this bug. Thank you. |
We seem to have this same problem with version 10.5.0 |
Hi All, We are also facing the same issue.. Do you guys have a fix yet for your apps. |
Hi All, I using realm in Xcode 12.4 version for iOS14, i have enabled the UIFileSharingEnabled , so the auxiliary Realm files store in Files in iPhone & iPad device , when i open iPhone & iPad files its loading its not showing auxiliary Realm files . i can't open file any files. please give any solution for me. |
even though realm i using the code below |
I using this below code, i can not delete Realm's default auxiliary files like default.ream, default.lock files, can you please help me. let applicationSupportDirectoryPath = paths.first let realmPath = applicationSupportDirectoryPath?.appending("default.realm")
|
Anybody fixed this issue? |
finally i got the solution Please use pod 'RealmSwift', '~> 10.5.0' This 10.5 version only support unrealm concept If enable UIFileSharing Enabled the files opening even the realm auxiliary files downloading |
Closing this as a solution seems to have been found. |
Goals
My app should be able to access already saved data from database.
Expected Results
As above
Actual Results
After some time spent in the app, users with iOS 14 and above can't get or save data from/to database. There's no error or crash - it seems like the info from database is not there anymore (but it is).
Steps for others to Reproduce
I was able to reproduce this only on the store version of my app - just opened it, navigated to a few screens, saved some data, retrieved some data.
After a while, after the app was send to background and activated again (for several times), when I try to read from database the same info that was ok before - realm says it's not there anymore. But after I run the same app from xcode (so on top of the one downloaded from store) - the info was there, I could read it, the database was ok to read and write again.
The issue goes away for awhile if the users reinstall the app, but after using it for a few minutes it happens again.
Code Sample
The database uses encryption as documented here: https://docs.realm.io/sync/using-synced-realms/encrypting-realms
Reading this issue, I already updated realm to the version 5.4.7, but the issue is still happening. And I don't think is the same problem because I don't have shared app group container implemented.
Version of Realm and Tooling
Realm framework version: 5.4.7
Xcode version: 12.0.1
iOS version: >= 14.0
Dependency manager + version: COCOAPODS 1.9.3
Our crash reporting tool found this kind of crashes, but I have no idea if is related to this issue or not (on the phone that I could reproduce 2 times there's no crash report), I never saw the app crashing (neither did the other users that faced this problem), but maybe it crashed when it was in the background.
Crashed: com.google.fira.worker
0 libobjc.A.dylib 0x19a4dcdf0 objc_release + 16
1 libobjc.A.dylib 0x19a4de584 AutoreleasePoolPage::releaseUntil(objc_object**) + 200
2 libobjc.A.dylib 0x19a4de460 objc_autoreleasePoolPop + 208
3 libdispatch.dylib 0x1868d2260 _dispatch_last_resort_autorelease_pool_pop + 40
4 libdispatch.dylib 0x18687bae4 _dispatch_lane_invoke$VARIANT$mp + 520
5 libdispatch.dylib 0x186885518 _dispatch_workloop_worker_thread + 712
6 libsystem_pthread.dylib 0x1cc57c5a4 _pthread_wqthread + 272
7 libsystem_pthread.dylib 0x1cc57f874 start_wqthread + 8
com.apple.main-thread
0 libsystem_kernel.dylib 0x1b15ec8c4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b15ebcc8 mach_msg + 72
2 CoreFoundation 0x186c1874c __CFRunLoopServiceMachPort + 376
3 CoreFoundation 0x186c12bd0 __CFRunLoopRun + 1176
4 CoreFoundation 0x186c12200 CFRunLoopRunSpecific + 572
5 GraphicsServices 0x19cd0d598 GSEventRunModal + 160
6 UIKitCore 0x1894d8004 -[UIApplication _run] + 1052
7 UIKitCore 0x1894dd5d8 UIApplicationMain + 164
8 libdyld.dylib 0x1868f1598 start + 4
Thread
0 libsystem_kernel.dylib 0x1b161058c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x1cc57c5f0 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x1cc57f874 start_wqthread + 8
DTX_COMM_THREAD_8.201.1.1002
0 libsystem_kernel.dylib 0x1b160fd00 __semwait_signal + 8
1 libsystem_c.dylib 0x18f8e0714 nanosleep + 212
2 Foundation 0x187e724f4 ﹍[NSThread sleepForTimeInterval:]﹍ 152
3 Dynatrace 0x100fe3608 hidden#3786
4 Foundation 0x187f78c48 NSThread__start + 848
5 libsystem_pthread.dylib 0x1cc57ab70 _pthread_start + 288
6 libsystem_pthread.dylib 0x1cc57f880 thread_start + 8
KSCrash Exception Handler (Secondary)
0 libsystem_kernel.dylib 0x1b15ec8c4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b15ebcc8 mach_msg + 72
2 libsystem_kernel.dylib 0x1b160962c thread_suspend + 80
3 Dynatrace 0x100f5e8a8 hidden#583
4 libsystem_pthread.dylib 0x1cc57ab70 _pthread_start + 288
5 libsystem_pthread.dylib 0x1cc57f880 thread_start + 8
KSCrash Exception Handler (Primary)
0 libsystem_kernel.dylib 0x1b15ec8c4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b15ebcc8 mach_msg + 72
2 Dynatrace 0x100f5e8d4 hidden#583
3 libsystem_pthread.dylib 0x1cc57ab70 _pthread_start + 288
4 libsystem_pthread.dylib 0x1cc57f880 thread_start + 8
com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1b15ec8c4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1b15ebcc8 mach_msg + 72
2 CoreFoundation 0x186c1874c __CFRunLoopServiceMachPort + 376
3 CoreFoundation 0x186c12bd0 __CFRunLoopRun + 1176
4 CoreFoundation 0x186c12200 CFRunLoopRunSpecific + 572
5 Foundation 0x187e1c278 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228
6 Foundation 0x187e1c158 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88
7 UIKitCore 0x1895839fc -[UIEventFetcher threadMain] + 504
8 Foundation 0x187f78c48 NSThread__start
9 libsystem_pthread.dylib 0x1cc57ab70 _pthread_start + 288
10 libsystem_pthread.dylib 0x1cc57f880 thread_start + 8
Realm notification listener
0 libsystem_kernel.dylib 0x1b16114b4 kevent + 8
1 Realm 0x1028c2fe0 realm::_impl::ExternalCommitHelper::listen() + 160
2 Realm 0x1028c3ae0 realm::_impl::ExternalCommitHelper::notify_others() + 2696
3 libsystem_pthread.dylib 0x1cc57ab70 _pthread_start + 288
4 libsystem_pthread.dylib 0x1cc57f880 thread_start + 8
The text was updated successfully, but these errors were encountered: