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

App crash on open #7998

Closed
imulaganathan opened this issue Aug 27, 2024 · 6 comments
Closed

App crash on open #7998

imulaganathan opened this issue Aug 27, 2024 · 6 comments

Comments

@imulaganathan
Copy link

SDK and version

SDK : Realm swift (Swift Package Manager)
Version: 10.53.0

Observations

  • How frequent do the crash occur?
    90% of time I'm getting this crash, while opening the application
  • Does it happen in production or during dev/test?
    It happening in dev / test, not yet checked in Production .
  • Can the crash be reproduced by you?
    Yes, I can reproduce the crash frequently.
  • Can you provide instructions for how we can reproduce it?
    To reproduce this issue just need to login and kill the app, next time while opening the app it getting crash.

Crash log / stacktrace

exceptions.cpp:80: [realm-core-14.12.0] Unreachable code
0 RealmSwift 0x000000010a3b04e0 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 RealmSwift 0x000000010a3b04c0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2 RealmSwift 0x000000010a3b038c _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3 RealmSwift 0x0000000109c514d8 _ZN5realm19exception_to_statusEv + 304
4 RealmSwift 0x0000000109f41334 _ZN5realm13AsyncOpenTask30wait_for_bootstrap_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEENS_6StatusE + 608
5 RealmSwift 0x0000000109f41c6c _ZN5realm13AsyncOpenTask26migrate_schema_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEE + 224
6 RealmSwift 0x0000000109f45f04 _ZZN5realm13AsyncOpenTask5startENS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEEEN3$_0clENS_6StatusE + 380
7 RealmSwift 0x0000000109f45c40 _ZN5realm4util14UniqueFunctionIFvNS_6StatusEEE12SpecificImplIZNS_13AsyncOpenTask5startENS1_IFvNS_19ThreadSafeReferenceESt13exception_ptrEEEE3$0E4callEOS2 + 60
8 RealmSwift 0x0000000109f7c3c4 ZNK5realm4util14UniqueFunctionIFvNS_6StatusEEEclES2 + 112
9 RealmSwift 0x0000000109f9f75c _ZZN5realm11SyncSession23add_completion_callbackENS_4util14UniqueFunctionIFvNS_6StatusEEEENS_5_impl20SyncProgressNotifier12NotifierTypeEENK4$12clES3 + 224
10 RealmSwift 0x0000000109f9f5bc _ZN5realm4util14UniqueFunctionIFvNS_6StatusEEE12SpecificImplIZNS_11SyncSession23add_completion_callbackES4_NS_5_impl20SyncProgressNotifier12NotifierTypeEE4$12E4callEOS2 + 60
11 RealmSwift 0x0000000109f7c3c4 ZNK5realm4util14UniqueFunctionIFvNS_6StatusEEEclES2 + 112
12 RealmSwift 0x000000010a145524 _ZN5realm4sync14SessionWrapper22on_download_completionEv + 156
13 RealmSwift 0x000000010a145478 _ZN5realm4sync10ClientImpl7Session22on_download_completionEv + 56
14 RealmSwift 0x000000010a22a098 _ZN5realm4sync10ClientImpl7Session29check_for_download_completionEv + 300
15 RealmSwift 0x000000010a227da0 _ZN5realm4sync10ClientImpl7Session20receive_mark_messageEy + 412
16 RealmSwift 0x000000010a227b88 _ZN5realm4sync10ClientImpl10Connection20receive_mark_messageEyy + 124
17 RealmSwift 0x000000010a224c8c _ZN5realm5_impl14ClientProtocol22parse_message_receivedINS_4sync10ClientImpl10ConnectionEEEvRT_NSt3__117basic_string_viewIcNS8_11char_traitsIcEEEE + 4384
18 RealmSwift 0x000000010a220918 _ZN5realm4sync10ClientImpl10Connection23handle_message_receivedENS_4util4SpanIKcLm18446744073709551615EEE + 112
19 RealmSwift 0x000000010a220800 _ZN5realm4sync10ClientImpl10Connection33websocket_binary_message_receivedENS_4util4SpanIKcLm18446744073709551615EEE + 248
20 RealmSwift 0x000000010a23b9e0 _ZN5realm4sync10ClientImpl10Connection21WebSocketObserverShim33websocket_binary_message_receivedENS_4util4SpanIKcLm18446744073709551615EEE + 100
21 RealmSwift 0x000000010a19c7dc _ZN5realm4sync9websocket12_GLOBAL__N_120DefaultWebSocketImpl33websocket_binary_message_receivedEPKcm + 80
22 RealmSwift 0x000000010a1d36e0 _ZN12_GLOBAL__N_19WebSocket17frame_reader_loopEv + 232
23 RealmSwift 0x000000010a1d51a4 _ZZN12_GLOBAL__N_19WebSocket17frame_reader_loopEvENKUlNSt3__110error_codeEmE_clES2_m + 180
24 RealmSwift 0x000000010a1d50b8 _ZN5realm4util14UniqueFunctionIFvNSt3__110error_codeEmEE12SpecificImplIZN12_GLOBAL__N_19WebSocket17frame_reader_loopEvEUlS3_mE_E4callEOS3_Om + 64
25 RealmSwift 0x000000010a1af044 _ZNK5realm4util14UniqueFunctionIFvNSt3__110error_codeEmEEclES3_m + 120
26 RealmSwift 0x000000010a1aedb8 ZN5realm4sync7network7Service9AsyncOper29do_recycle_and_execute_helperINS_4util14UniqueFunctionIFvNSt3__110error_codeEmEEEJS8_mEEEvbRbT_DpT0 + 108
27 RealmSwift 0x000000010a1aecd0 ZN5realm4sync7network7Service9AsyncOper22do_recycle_and_executeINS_4util14UniqueFunctionIFvNSt3__110error_codeEmEEEJRS8_RmEEEvbRT_DpOT0 + 168
28 RealmSwift 0x000000010a1ae714 _ZN5realm4sync7network7Service14BasicStreamOpsINS1_3ssl6StreamEE16BufferedReadOperINS_4util14UniqueFunctionIFvNSt3__110error_codeEmEEEE19recycle_and_executeEv + 656
29 RealmSwift 0x000000010a1c02b0 _ZN5realm4sync7network7Service4Impl7executeERNSt3__110unique_ptrINS2_9AsyncOperENS2_18LendersOperDeleterEEE + 36
30 RealmSwift 0x000000010a1bffbc _ZN5realm4sync7network7Service4Impl8run_implEb + 320
31 RealmSwift 0x000000010a1bbda4 _ZN5realm4sync7network7Service4Impl17run_until_stoppedEv + 32
32 RealmSwift 0x000000010a1bbd78 _ZN5realm4sync7network7Service17run_until_stoppedEv + 28
33 RealmSwift 0x000000010a195df4 _ZN5realm4sync9websocket21DefaultSocketProvider10event_loopEv + 352
34 RealmSwift 0x000000010a19a56c ZNSt3__18__invokeB8ue170006IMN5realm4sync9websocket21DefaultSocketProviderEFvvEPS4_JEvEEDTcldsdeclsr3stdE7declvalIT0_EEclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT1_EEEEOS9_OS8_DpOSA + 116
35 RealmSwift 0x000000010a19a4ec _ZNSt3__116__thread_executeB8ue170006INS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEMN5realm4sync9websocket21DefaultSocketProviderEFvvEJPS9_EJLm2EEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE + 48
36 RealmSwift 0x000000010a19a198 ZNSt3__114__thread_proxyB8ue170006INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN5realm4sync9websocket21DefaultSocketProviderEFvvEPSA_EEEEEPvSF + 84
37 libsystem_pthread.dylib 0x00000001059134c0 _pthread_start + 104
38 libsystem_pthread.dylib 0x000000010590e6f0 thread_start + 8
!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose

Steps & Code to Reproduce

To reproduce this issue just need to login and kill the app, next time while opening the app it getting crash.

Copy link

sync-by-unito bot commented Aug 27, 2024

➤ PM Bot commented:

Jira ticket: RCORE-2241

@nicola-cab
Copy link
Member

@imulaganathan the stack trace looks identical to this #7997. Are you getting the same error message?
"The following changes cannot be made in additive-only schema mode ....."

@imulaganathan
Copy link
Author

imulaganathan commented Aug 28, 2024

@nicola-cab it's not like #7997, the crash still occurs even after uninstalling the app.

Here is my configuration code Snippet
let config = user.flexibleSyncConfiguration( clientResetMode: .discardUnsyncedChanges( beforeReset: { realm in SubOps.prepareReset(with: realm) } ), initialSubscriptions: { if SubOps.subInit(subs: $0, user: user) == true { return } }, rerunOnOpen: true )
and this is the code I used for AsyncOpen
`@AsyncOpen(appId: G.shared.atlas.appId, timeout: 4000) var asyncOpen

switch asyncOpen
{
case .connecting:
ProgressView()

case .waitingForUser:
  ProgressView("Waiting for user to log in...")
  
case .open(let realm):
  Dashboard(userID: $userID)
  .environment(\.realm, realm)

 case .error(let error):
     ErrorView(error: error)
     
case .progress(let progress):
   ProgressView(progress)
  
}

`

@nicola-cab
Copy link
Member

@imulaganathan what I meant is that both stack traces are crashing in the same place:

#7997

exceptions.cpp:80: [realm-core-14.10.1] Unreachable code
0 RealmSwift 0x00000001052c2504 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 RealmSwift 0x00000001052c24e4 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2 RealmSwift 0x00000001052c23b0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3 RealmSwift 0x0000000104b67f04 _ZN5realm19exception_to_statusEv + 304
4 RealmSwift 0x0000000104e56fd4 _ZN5realm13AsyncOpenTask30wait_for_bootstrap_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEENS_6StatusE + 596
5 RealmSwift 0x0000000104e5790c _ZN5realm13AsyncOpenTask26migrate_schema_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceE

vs your stack trace:

exceptions.cpp:80: [realm-core-14.12.0] Unreachable code
0 RealmSwift 0x000000010a3b04e0 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 RealmSwift 0x000000010a3b04c0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2 RealmSwift 0x000000010a3b038c _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3 RealmSwift 0x0000000109c514d8 _ZN5realm19exception_to_statusEv + 304
4 RealmSwift 0x0000000109f41334 _ZN5realm13AsyncOpenTask30wait_for_bootstrap_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEENS_6StatusE + 608
5 RealmSwift 0x0000000109f41c6c _ZN5realm13AsyncOpenTask26migrate_schema_or_completeEONS_4util14UniqueFunctionIFvNS_19ThreadSafeReferenceESt13exception_ptrEEENSt3__110shared_ptrINS_5_impl16RealmCoordinatorEEE + 224

Now, it migth also be that the same issue is triggered by 2 different use cases. I am going to try with your setup and see.

@jedelbo
Copy link
Contributor

jedelbo commented Aug 29, 2024

I am pretty sure that this is caused by some schema incompatibility that will make us throw an exception. This exception is then caught in the Swift SDK code and translated into an NSError exception which is then thrown. When we catch this in RealmCore, we cannot translate that into something we know, so we terminate. So my guess would be that if you can avoid the schema changes, the the error will dissappear.

@jedelbo
Copy link
Contributor

jedelbo commented Sep 20, 2024

#8010 changes the way exceptions are handled, so updating to the newest version will probably better show what the underlying problem is. I will close this issue for now, but you are welcome to reopen if new information is available.

@jedelbo jedelbo closed this as completed Sep 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 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