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
"Decryption failed" errors immediately after compacting two Realm files on startup #8514
Comments
➤ PM Bot commented: Jira ticket: RCOCOA-2307 |
I think culprit is realm-core. This issue started happening with version > 10.41.0. |
Hey, I was unable to reproduce this using the project. Are there any more steps that need to be added? |
Were you running in simulator or on an iPad? It fails consistently for me when running on an iPad, but I have never seen it fail using the simulator. |
I definitely think the culprit is in realm-core; should I file a bug there? It is reproducible for me using realm-swift 10.30.0. I haven't tested with earlier versions, but it's probably worth bisecting. EDIT: Just tested with realm-swift 10.10.0, which is the earliest version that will actually build successfully with the current Xcode and my test codebase, and the problem is definitely still present there. This is using realm-core v11.0.4, and the test device is a 7th generation iPad running iPadOS 17.3. So if realm/realm-core#7322 was just a regression in v13.17.1, then it's not the same bug. |
realm/realm-core#7322 didn't make it into 10.49.2, but will be released as part of the next release. |
How frequently does the bug occur?
Always
Description
We have an app that has been using realm-swift v10.30. In the normal case, it uses two encrypted Realm databases; one that holds a small amount of data shared between all users of the app, and one that holds a much larger amount of data, that is user-specific. Some of the user-specific data has large objects containing hundreds of kilobytes or even megabytes of data, encoded as long strings. Both databases are opened on startup.
Our customers are intermittently encountering an issue where their Realm databases appear to become subtly corrupted, and writes to certain tables begin to fail - sometimes with a Swift exception that can be caught from
realm.write
, and sometimes with a C++ exception that crashes the app.We consistently see the following pattern in the customers' logs:
shouldCompactOnLaunch
callback. The affected customers frequently use the app successfully for hours during the previous session, with no problems. The compacting process on startup seems to corrupt the database.After upgrading to realm-swift v10.46.0 we continued to see the same problems, so I created a test case (linked below) based on the common usage patterns of the customers experiencing this issue. This seems to reproduce the problem, even on the latest version.
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
A test app that reproduces this issue, with detailed steps for reproduction, is available here: https://github.com/SHOEBOXAudiometry/RealmEncryptionFailureTest
Version
realm-swift 10.48
What Atlas Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
iOS 17.3
Build environment
The text was updated successfully, but these errors were encountered: