-
Notifications
You must be signed in to change notification settings - Fork 173
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
Assertion failed in EncryptedFileMapping::get_local_index_of_address #6752
Comments
➤ On 2023-06-27, bb-git commented: Ok, we went through the same crash from a previous release: please_report_this_issue_in_github_realm_realm_core_v_13_10_1 |
@bb-git thanks for reporting this. Do you know what the previous version was that users were updating from? Do you know if the Realm is being accessed from multiple processes? An assertion failure like this one will be difficult to track unless we can get some more information or a way to reproduce it so anything of relevance you can add will help us! Note that if the previous version of Realm was an old enough version, this may have been fixed by #5383 |
We used version 10.36.0 before. Yes, we access Realm from multiple processes. Looking at where the crash occurs, this is the first time the database is accessed and this happens on the main thread. And it seems, if it's crashing, then it crashes on every launch. I think I saw the issue mentioned in the release notes, we introduced encryption just a week ago and the the Realm version we used for this release was 10.39.1. For users coming from an older version we create an encrypted copy. If the decryption fails on the first init, we delete the realm file and the data gets downloaded again from the backend. |
@bb-git thanks for that info. When you say you "introduced encryption" how did you migrate existing unencrypted data to the encrypted file? Given that you are using multiple processes, you may need to take steps to prevent concurrent access to the file if you are using a file system copy/move (or one of our APIs which use them). Internal note: Swift version 10.36.0 (2023-02-15) is using core 13.4.1. Swift 10.39.1 (2023-05-05) is core version 13.10.1. |
As mentioned, we make a copy of the database file with encryption. This all happens before accessing the file on multiple threads. From our investigation: it seems the crash happens in the background. The only explanation we have so far is, that HealthKit launches the app after new data came in. Even more confusing for us, the access to Realm where the crash happens is wrapped in a do catch block. This crash happens only to a few of our users, so it can't be a general issue with the background calls from HealthKit. Our theory is, that it might be an issue, if the app is updated by the system and then launched by HealthKit, maybe in combination, that the device wasn't unlocked for the first time. This would more or less explain the number and frequency. We see around 10 crashes per affected user. Do you have any ideas what to look at next, especially what can cause an error like this? |
@bb-git thanks for that info.
This is an assertion failure, not an exception that can be caught unfortunately. |
No, that can't be. We already catch and record the error during the copy process and it happened only once and not even for the same device. Also this is the first access of the realm file it happens at the very early stage in applicationDidFinishLaunching. All runners are initialized at a later stage. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
This could be fixed by #7162 assuming multiple encrypted Realms are being opened on an external exFAT drive. |
We are an iOS only app, so I guess not external exFAT drives. Also we use only one encrypted Realm, but this one we access on multiple threads. |
How frequently does the bug occur?
Sometimes
Description
Crash, that asked to be reported.
We introduced encryption to one of our realm files.
A few users experience this crash.
Stacktrace & log output
Can you reproduce the bug?
No
Reproduction Steps
No response
Version
10.40.2
What Atlas Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
iOS 16.5.1
Build environment
Xcode version: 14.3.1
Dependency manager and version: SPM
The text was updated successfully, but these errors were encountered: