Skip to content
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

Crash On Write w/ Encrypted Realm (instructed to report) #5332

Closed
thecoolwinter opened this issue Mar 17, 2022 · 2 comments
Closed

Crash On Write w/ Encrypted Realm (instructed to report) #5332

thecoolwinter opened this issue Mar 17, 2022 · 2 comments
Assignees

Comments

@thecoolwinter
Copy link

SDK and version

SDK : Cocoa (Swift)
Version: Core: 11.9.0 RealmSwift: 10.22.0

Observations

  • How frequent does the crash occur? => semi-often.
  • Does it happen in production or during dev/test? => Production
  • Can the crash be reproduced by you? => No it's seemingly random. It looks like it has something to do with encryption of the realm file.
  • Can you provide instructions for how we can reproduce it? => Not really, I can't reproduce it well myself.

Crash log / stacktrace

mismatch 0x281b26b68: fd(15)page(0/64) \260\246� \260\246�
/Users/Khan/Library/Developer/Xcode/DerivedData/WinterFamilyCare-ajhcgydbipvgtqfhnnikygolpvmf/SourcePackages/checkouts/realm-core/src/realm/util/encrypted_file_mapping.cpp:589: [realm-core-11.9.0] 
0   DirectCareApp                       0x00000001036d65c4 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   DirectCareApp                       0x00000001036d67f0 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 224
2   DirectCareApp                       0x000000010364de34 _ZN5realm4util20EncryptedFileMapping13validate_pageEm + 1004
3   DirectCareApp                       0x000000010364deb8 _ZN5realm4util20EncryptedFileMapping8validateEv + 68
4   DirectCareApp                       0x000000010364cc04 _ZN5realm4util20EncryptedFileMapping5flushEv + 280
5   DirectCareApp                       0x000000010367e9a0 _ZN5realm4util4File7MapBase5flushEv + 100
6   DirectCareApp                       0x0000000102f0b6f8 _ZN5realm4util4File3MapIcE5flushEv + 24
7   DirectCareApp                       0x0000000102f0b6d4 _ZN5realm11GroupWriter9MapWindow5flushEv + 24
8   DirectCareApp                       0x0000000102f0c334 _ZN5realm11GroupWriter18flush_all_mappingsEv + 116
9   DirectCareApp                       0x0000000102f0fcf8 _ZN5realm11GroupWriter6commitEm + 380
10  DirectCareApp                       0x0000000102ed34e4 _ZZN5realm11Transaction9async_endENS_4util14UniqueFunctionIFvvEEEENK3$_3clEv + 116
11  DirectCareApp                       0x0000000102ed3464 _ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZNS_11Transaction9async_endES3_E3$_3EEvNSt3__117integral_constantIbLb1EEERT_ + 24
12  DirectCareApp                       0x0000000102ed33b8 _ZZN5realm4util14UniqueFunctionIFvvEE9make_implIZNS_11Transaction9async_endES3_E3$_3EEDaOT_EN12SpecificImpl4callEv + 28
13  DirectCareApp                       0x0000000102ea9ac0 _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 96
14  DirectCareApp                       0x0000000102ea972c _ZN5realm2DB17AsyncCommitHelper4mainEv + 156
15  DirectCareApp                       0x0000000102ebaa64 _ZZN5realm2DB17AsyncCommitHelper12start_threadEvENKUlvE_clEv + 28
16  DirectCareApp                       0x0000000102ebaa00 _ZNSt3__1L8__invokeIZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS5_DpOS6_ + 28
17  DirectCareApp                       0x0000000102eba998 _ZNSt3__1L16__thread_executeINS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEJEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 32
18  DirectCareApp                       0x0000000102eba198 _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_EEEEEPvSC_ + 80
19  libsystem_pthread.dylib             0x00000001f1ca39a4 _pthread_start + 148
20  libsystem_pthread.dylib             0x00000001f1ca2ea0 thread_start + 8!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2022-03-16 20:16:44.519196-0500 DirectCareApp[926:154079] /Users/Khan/Library/Developer/Xcode/DerivedData/WinterFamilyCare-ajhcgydbipvgtqfhnnikygolpvmf/SourcePackages/checkouts/realm-core/src/realm/util/encrypted_file_mapping.cpp:589: [realm-core-11.9.0] 
0   DirectCareApp                       0x00000001036d65c4 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   DirectCareApp                       0x00000001036d67f0 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 224
2   DirectCareApp                       0x000000010364de34 _ZN5realm4util20EncryptedFileMapping13validate_pageEm + 1004
3   DirectCareApp                       0x000000010364deb8 _ZN5realm4util20EncryptedFileMapping8validateEv + 68
4   DirectCareApp                       0x000000010364cc04 _ZN5realm4util20EncryptedFileMapping5flushEv + 280
5   DirectCareApp                       0x000000010367e9a0 _ZN5realm4util4File7MapBase5flushEv + 100
6   DirectCareApp                       0x0000000102f0b6f8 _ZN5realm4util4File3MapIcE5flushEv + 24
7   DirectCareApp                       0x0000000102f0b6d4 _ZN5realm11GroupWriter9MapWindow5flushEv + 24
8   DirectCareApp                       0x0000000102f0c334 _ZN5realm11GroupWriter18flush_all_mappingsEv + 116
9   DirectCareApp                       0x0000000102f0fcf8 _ZN5realm11GroupWriter6commitEm + 380
10  DirectCareApp                       0x0000000102ed34e4 _ZZN5realm11Transaction9async_endENS_4util14UniqueFunctionIFvvEEEENK3$_3clEv + 116
11  DirectCareApp                       0x0000000102ed3464 _ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZNS_11Transaction9async_endES3_E3$_3EEvNSt3__117integral_constantIbLb1EEERT_ + 24
12  DirectCareApp                       0x0000000102ed33b8 _ZZN5realm4util14UniqueFunctionIFvvEE9make_implIZNS_11Transaction9async_endES3_E3$_3EEDaOT_EN12SpecificImpl4callEv + 28
13  DirectCareApp                       0x0000000102ea9ac0 _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 96
14  DirectCareApp                       0x0000000102ea972c _ZN5realm2DB17AsyncCommitHelper4mainEv + 156
15  DirectCareApp                       0x0000000102ebaa64 _ZZN5realm2DB17AsyncCommitHelper12start_threadEvENKUlvE_clEv + 28
16  DirectCareApp                       0x0000000102ebaa00 _ZNSt3__1L8__invokeIZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOS5_DpOS6_ + 28
17  DirectCareApp                       0x0000000102eba998 _ZNSt3__1L16__thread_executeINS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_JEJEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 32
18  DirectCareApp                       0x0000000102eba198 _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm2DB17AsyncCommitHelper12start_threadEvEUlvE_EEEEEPvSC_ + 80
19  libsystem_pthread.dylib             0x00000001f1ca39a4 _pthread_start + 148
20  libsystem_pthread.dylib             0x00000001f1ca2ea0 thread_start + 8!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

Steps & Code to Reproduce

The only thing that the stack trace leads back to is a try realm.write instruction. It was on a background thread however if that makes a difference.

@thecoolwinter
Copy link
Author

After updating to Core: 11.11 & Swift 10.24.1 The problem persists.

And more info: This happens immediately after setting the realm configuration, the first time the realm is opened in the app. It does happen on a background thread but nothing has been done on any other threads yet so it's the realm is being opened only on that one thread.

Why isn't this being caught in the normal Realm error handling? It's frustrating because instead of being able to do something like restore the realm from a backup my app crashes no matter what. Is there a way to catch an error like this?

@sync-by-unito
Copy link

sync-by-unito bot commented Apr 25, 2022

➤ Finn Andersen commented:

Fixed by realm-core 11.14

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants