-
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
tvOS 14.3: When Realm is stored in a shared app group container the app is terminated by tvOS #7053
Comments
Hi @mskrischke , |
Hi @pavel-ship-it, |
We unfortunately can't really support sharing a Realm between processes on tvOS. On other platforms, we use named pipes for inter-process synchronization, but tvOS does not support named pipes. Each of the options we do have available to us on tvOS have various problems. One option is to wrap all of your uses of Realm in NSFileCoordinator, which works very awkwardly with our API as you can't hold onto any objects outside of the callback blocks. |
Oh, that's unfortunate. I guess this changed with tvOS 14? In my current setup I have the Realm files in an app group container so I can access them from a Topshelf extension. The extension however only needs read access and doesn't store or manipulate anything in the database. The obvious workaround would be to move the realm files back into the app's Cache folder and find another way to transmit the necessary data to the extension. I was wondering however if there maybe is some Realm specific configuration that would support my current setup and that I am missing? Like read-only access from the extension and automatic removal of locks when the main app is suspended for example. |
In any case I think the documentation under https://realm.io/docs/swift/latest/#tvos should be updated and state clearly that sharing between app and extension is not supported anymore under tvOS 14. |
Goals
The app should not be terminated because of open file locks. This seems to be the same problem as in #6671. On tvOS the same issue however seems to still exist.
Expected Results
When the app enters background it stays suspended and is not terminated by runningboardd
Actual Results
runningboardd detects open file locks in a directory where file locks are not allowed and therefore terminates the app.
Steps for others to Reproduce
Instantiate Realm in a shared container for the application group as described in https://realm.io/docs/swift/latest/#tvos.
Code Sample
If I create the database in the default directory for tvOS there is no crash when the app enters background. Only when I create the database in the shared container for the application group the app gets terminated when entering background.
From the console log:
I created a minimal sample project that reproduces the issue:
tvos_crash_sample.zip
And here the corresponding log from the Apple TV:
log_sample_crash.txt
Version of Realm and Tooling
Realm framework version: 10.5.1
Realm Object Server version: -
Xcode version: 12.3
iOS/OSX version: tvOS 14.3
Dependency manager + version: Cocoapods 1.10.1
Device: Crash seems to only happen on real devices, reproducable on Apple TV 4K and Apple TV 4th Gen.
The text was updated successfully, but these errors were encountered: