realm-swift: Crash in encrypted realm
How frequently does the bug occur?
All the time
Description
Hi, after upgrading Realm I noticed a crash happening once the app had started up which then seems to corrupt the realm object. I’ve narrowed it down to upgrading from realm swift 10.21.0 to 10.21.1.
The app will launch OK and seem to run until some kind of interaction happens with the realm. When the app is restarted the realm can no longer be opened and needs to be recreated. I’ve checked the password remains consistent and none of the code to do the setup has changed for a long time.
Stacktrace & log output
0 App 0x000000010acc22dc _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 App 0x000000010acc259f _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 287
2 App 0x000000010ac374ab _ZN5realm4util20EncryptedFileMapping13validate_pageEm + 1275
3 App 0x000000010ac37524 _ZN5realm4util20EncryptedFileMapping8validateEv + 68
4 App 0x000000010ac36043 _ZN5realm4util20EncryptedFileMapping5flushEv + 307
5 App 0x000000010ac68826 _ZN5realm4util4File7MapBase5flushEv + 118
6 App 0x000000010a46ba45 _ZN5realm4util4File3MapIcE5flushEv + 21
7 App 0x000000010a46ba25 _ZN5realm11GroupWriter9MapWindow5flushEv + 21
8 App 0x000000010a46c907 _ZN5realm11GroupWriter18flush_all_mappingsEv + 135
9 App 0x000000010a470f4e _ZN5realm11GroupWriter6commitEm + 382
10 App 0x000000010a42e2af _ZZN5realm11Transaction9async_endENS_4util14UniqueFunctionIFvvEEEENK3$_3clEv + 159
11 App 0x000000010a42e205 _ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZNS_11Transaction9async_endES3_E3$_3EEvNSt3__117integral_constantIbLb1EEERT_ + 21
12 App 0x000000010a42e169 _ZZN5realm4util14UniqueFunctionIFvvEE9make_implIZNS_11Transaction9async_endES3_E3$_3EEDaOT_EN12SpecificImpl4callEv + 25
13 App 0x000000010a40db0a _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 106
14 App 0x000000010a40d6ed _ZN5realm2DB17AsyncCommitHelper4mainEv + 205
15 App 0x000000010a41c6e8 _ZZN5realm2DB17AsyncCommitHelper12start_threadEvENKUlvE_clEv + 24
16 App 0x000000010a41c68d _ZNSt3__1L8__invokeIZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS5_DpOS6_ + 29
17 App 0x000000010a41c625 _ZNSt3__1L16__thread_executeINS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEJEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 37
18 App 0x000000010a41bea5 _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_EEEEEPvSC_ + 101
19 libsystem_pthread.dylib 0x00007fff6da2b8fc _pthread_start + 224
20 libsystem_pthread.dylib 0x00007fff6da27443 thread_start + 15!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
Can you reproduce the bug?
Yes, always
Reproduction Steps
The encryption of the Realm is handled as described here https://docs.mongodb.com/realm/sdk/swift/advanced-guides/encrypt-a-realm/
The configuration is
Realm.Configuration( fileURL: Utils.documentsURLFor(fileName: “cache.realm”), encryptionKey: {KEY}, schemaVersion: 113, migrationBlock: {…} )
And when accessing it the Realm initially with try Realm() there is no error thrown. The database has been integrated for a few years now and this basic flow hasn’t changed in that time
Version
10.21.1
What SDK flavour are you using?
Local Database only
Are you using encryption?
Yes, using encryption
Platform OS and version(s)
iOS 15.2
Build environment
Xcode version: 13.2 & 13.2.1 Dependency manager and version: Swift Package Manager
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 22 (2 by maintainers)
@allanweir, @cupcake-shukla, @bmt2018, @matthewjordanRiM, @c128128, @kordem, @Sethmr This issue is fixed in Realm v10.25.1 Please let us know if you still see the problem.