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

The app crashed due to an error in the serverless function #6758

Closed
Sciforearth opened this issue Jun 29, 2023 · 8 comments · Fixed by #6783
Closed

The app crashed due to an error in the serverless function #6758

Sciforearth opened this issue Jun 29, 2023 · 8 comments · Fixed by #6783
Assignees
Labels
Needs-Attention Reporter has responded. Review comment. O-Community

Comments

@Sciforearth
Copy link

SDK and version

SDK : Realm swift
Version: 10.40.0

Observations

  • How frequent do the crash occur?
    Everytime there is an error in the backend the app crash even after proper error handling on both ends, which does not happen in android sdk and should not happen

  • Does it happen in production or during dev/test?
    every environment

  • Can the crash be reproduced by you?
    yes

  • Can you provide instructions for how we can reproduce it?
    mark some field as required in the schema and then call a function from the ios sdk, function that will insert a document (do not pass the required field) to the collection the client app crashes

Crash log / stacktrace

[realm-core-13.13.0] Assertion failed: ErrorCodes::error_categories(code).test(ErrorCategory::runtime_error)
0 Gopalganj 0x00000001038c7b44 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Gopalganj 0x00000001038c7b24 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2 Gopalganj 0x00000001038c79f0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3 Gopalganj 0x000000010317fc50 _ZN5realm12RuntimeErrorC2ENS_10ErrorCodes5ErrorENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE + 196
4 Gopalganj 0x00000001034967fc _ZN5realm3app8AppErrorC2ENS_10ErrorCodes5ErrorENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESA_NS4_8optionalIiEE + 184
5 Gopalganj 0x0000000103496ad0 _ZN5realm3app8AppErrorC1ENS_10ErrorCodes5ErrorENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESA_NS4_8optionalIiEE + 44
6 Gopalganj 0x000000010348140c _ZN5realm3app8AppUtils16check_for_errorsERKNS0_8ResponseE + 1024
7 Gopalganj 0x000000010347c86c _ZZN5realm3app3App24do_authenticated_requestEONS0_7RequestERKNSt3__110shared_ptrINS_8SyncUserEEEONS_4util14UniqueFunctionIFvRKNS0_8ResponseEEEEEN4$10clESE + 44
8 Gopalganj 0x000000010347c77c _ZN5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEE12SpecificImplIZNS2_3App24do_authenticated_requestEONS2_7RequestERKNSt3__110shared_ptrINS_8SyncUserEEEOS7_E4$10E4callES5 + 36
9 Gopalganj 0x00000001034589f0 ZNK5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEEclES5 + 108
10 Gopalganj 0x0000000103458604 _ZN5realm3app3App33handle_possible_redirect_responseEONS0_7RequestERKNS0_8ResponseEONS_4util14UniqueFunctionIFvS6_EEE + 124
11 Gopalganj 0x000000010347be70 _ZZZN5realm3app3App26update_metadata_and_resendEONS0_7RequestEONS_4util14UniqueFunctionIFvRKNS0_8ResponseEEEERKNSt3__18optionalINSC_12basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEEEEN3$8clERKNSD_IS6_EEENUlS3_S8_E_clES3_S8 + 56
12 Gopalganj 0x000000010347bd68 _ZN5realm4util14UniqueFunctionIFvONS_3app7RequestERKNS2_8ResponseEEE12SpecificImplIZZNS2_3App26update_metadata_and_resendES4_ONS1_IFvS7_EEERKNSt3__18optionalINSF_12basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEEEEN3$8clERKNSG_IS5_EEEUlS4_S7_E_E4callES4_S7 + 44
13 Gopalganj 0x0000000103463788 ZNK5realm4util14UniqueFunctionIFvONS_3app7RequestERKNS2_8ResponseEEEclES4_S7 + 116
14 Gopalganj 0x0000000103463708 ZZN5realm3app23GenericNetworkTransport22send_request_to_serverEONS0_7RequestEONS_4util14UniqueFunctionIFvS3_RKNS0_8ResponseEEEEENKUlS8_E_clES8 + 52
15 Gopalganj 0x0000000103463638 ZN5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEE12SpecificImplIZNS2_23GenericNetworkTransport22send_request_to_serverEONS2_7RequestEONS1_IFvSB_S5_EEEEUlS5_E_E4callES5 + 36
16 Gopalganj 0x0000000102c6ad34 ZNK5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEEclES5 + 108
17 Gopalganj 0x0000000102c6a8d8 ___ZN12_GLOBAL__N_121CocoaNetworkTransport22send_request_to_serverERKN5realm3app7RequestEONS1_4util14UniqueFunctionIFvRKNS2_8ResponseEEEE_block_invoke + 568
18 Gopalganj 0x0000000102d1b2c8 -[RLMSessionDelegate URLSession:task:didCompleteWithError:] + 616
19 CFNetwork 0x00000001cbadd47c CFURLRequestCopyHTTPRequestMethod + 2272
20 libdispatch.dylib 0x000000010721053c _dispatch_call_block_and_release + 32
21 libdispatch.dylib 0x0000000107211ff0 _dispatch_client_callout + 20
22 libdispatch.dylib 0x000000010721a0a0 _dispatch_lane_serial_drain + 988
23 libdispatch.dylib 0x000000010721adfc _dispatch_lane_invoke + 472
24 libdispatch.dylib 0x0000000107227cac _dispatch_workloop_worker_thread + 740
25 libsystem_pthread.dylib 0x0000000218bb0df8 _pthread_wqthread + 288
26 libsystem_pthread.dylib 0x0000000218bb0b98 start_wqthread + 8
!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2023-06-29 17:50:34.730343+0530 Gopalganj[11720:3614622] /Users/deepanshu/Library/Developer/Xcode/DerivedData/Gopalganj-cbkmoqlopfdyaugehidvfcgpuame/SourcePackages/checkouts/realm-core/src/realm/exceptions.cpp:104: [realm-core-13.13.0] Assertion failed: ErrorCodes::error_categories(code).test(ErrorCategory::runtime_error)
0 Gopalganj 0x00000001038c7b44 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Gopalganj 0x00000001038c7b24 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 308
2 Gopalganj 0x00000001038c79f0 _ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE + 0
3 Gopalganj 0x000000010317fc50 _ZN5realm12RuntimeErrorC2ENS_10ErrorCodes5ErrorENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE + 196
4 Gopalganj 0x00000001034967fc _ZN5realm3app8AppErrorC2ENS_10ErrorCodes5ErrorENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESA_NS4_8optionalIiEE + 184
5 Gopalganj 0x0000000103496ad0 _ZN5realm3app8AppErrorC1ENS_10ErrorCodes5ErrorENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESA_NS4_8optionalIiEE + 44
6 Gopalganj 0x000000010348140c _ZN5realm3app8AppUtils16check_for_errorsERKNS0_8ResponseE + 1024
7 Gopalganj 0x000000010347c86c _ZZN5realm3app3App24do_authenticated_requestEONS0_7RequestERKNSt3__110shared_ptrINS_8SyncUserEEEONS_4util14UniqueFunctionIFvRKNS0_8ResponseEEEEEN4$10clESE + 44
8 Gopalganj 0x000000010347c77c _ZN5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEE12SpecificImplIZNS2_3App24do_authenticated_requestEONS2_7RequestERKNSt3__110shared_ptrINS_8SyncUserEEEOS7_E4$10E4callES5 + 36
9 Gopalganj 0x00000001034589f0 ZNK5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEEclES5 + 108
10 Gopalganj 0x0000000103458604 _ZN5realm3app3App33handle_possible_redirect_responseEONS0_7RequestERKNS0_8ResponseEONS_4util14UniqueFunctionIFvS6_EEE + 124
11 Gopalganj 0x000000010347be70 _ZZZN5realm3app3App26update_metadata_and_resendEONS0_7RequestEONS_4util14UniqueFunctionIFvRKNS0_8ResponseEEEERKNSt3__18optionalINSC_12basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEEEEN3$8clERKNSD_IS6_EEENUlS3_S8_E_clES3_S8 + 56
12 Gopalganj 0x000000010347bd68 _ZN5realm4util14UniqueFunctionIFvONS_3app7RequestERKNS2_8ResponseEEE12SpecificImplIZZNS2_3App26update_metadata_and_resendES4_ONS1_IFvS7_EEERKNSt3__18optionalINSF_12basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEEEEN3$8clERKNSG_IS5_EEEUlS4_S7_E_E4callES4_S7 + 44
13 Gopalganj 0x0000000103463788 ZNK5realm4util14UniqueFunctionIFvONS_3app7RequestERKNS2_8ResponseEEEclES4_S7 + 116
14 Gopalganj 0x0000000103463708 ZZN5realm3app23GenericNetworkTransport22send_request_to_serverEONS0_7RequestEONS_4util14UniqueFunctionIFvS3_RKNS0_8ResponseEEEEENKUlS8_E_clES8 + 52
15 Gopalganj 0x0000000103463638 ZN5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEE12SpecificImplIZNS2_23GenericNetworkTransport22send_request_to_serverEONS2_7RequestEONS1_IFvSB_S5_EEEEUlS5_E_E4callES5 + 36
16 Gopalganj 0x0000000102c6ad34 ZNK5realm4util14UniqueFunctionIFvRKNS_3app8ResponseEEEclES5 + 108
17 Gopalganj 0x0000000102c6a8d8 ___ZN12_GLOBAL__N_121CocoaNetworkTransport22send_request_to_serverERKN5realm3app7RequestEONS1_4util14UniqueFunctionIFvRKNS2_8ResponseEEEE_block_invoke + 568
18 Gopalganj 0x0000000102d1b2c8 -[RLMSessionDelegate URLSession:task:didCompleteWithError:] + 616
19 CFNetwork 0x00000001cbadd47c CFURLRequestCopyHTTPRequestMethod + 2272
20 libdispatch.dylib 0x000000010721053c _dispatch_call_block_and_release + 32
21 libdispatch.dylib 0x0000000107211ff0 _dispatch_client_callout + 20
22 libdispatch.dylib 0x000000010721a0a0 _dispatch_lane_serial_drain + 988
23 libdispatch.dylib 0x000000010721adfc _dispatch_lane_invoke + 472
24 libdispatch.dylib 0x0000000107227cac _dispatch_workloop_worker_thread + 740
25 libsystem_pthread.dylib 0x0000000218bb0df8 _pthread_wqthread + 288
26 libsystem_pthread.dylib 0x0000000218bb0b98 start_wqthread + 8
!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose

Steps & Code to Reproduce

@nicola-cab
Copy link
Member

Hello, thank you for reporting this, it seems you hit a problem in the network code, in particular the error message received does not match what we were expecting.
ErrorCodes::error_categories(code).test(ErrorCategory::runtime_error).
@danieltabacaru, @michael-wb can you have a look please?

@danieltabacaru
Copy link
Collaborator

@michael-wb I think the issue here is that AppError's are RuntimeError's, but not all possible errors that fall under AppError have runtime_error as error category (see error_code.cpp).

@michael-wb
Copy link
Contributor

That's a lot of error codes to check: https://github.com/realm/realm-core/blob/master/src/realm/error_codes.cpp#L229-L376
Assign this to me and I'll make the updates.

@michael-wb michael-wb self-assigned this Jul 5, 2023
@danieltabacaru
Copy link
Collaborator

@michael-wb As Nicola suggested, it's most likely an error we receive from the server (not something we synthesize) and I guess it's not a RuntimeError as it should be, so maybe you should check with the server folks.

@michael-wb
Copy link
Contributor

Yes - I noticed that if we receive an unknown server error code (that we don't have an ErrorCodes::Error mapping), the lookup function returns UnknownError which doesn't have any error categories - this would def cause the assertion failure. I am updating app utils to convert this to AppUnknownError and include the error code string in the message. I was also going to update the list of baas server error values in ErrorCodes.

@michael-wb
Copy link
Contributor

@Sciforearth - would you be able to check your app server logs to see if you can see what error is being reported to the client?

@Sciforearth
Copy link
Author

Sciforearth commented Jul 14, 2023

it was related schema validation, the field expected was date but string was getting passed.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jul 14, 2023
@sync-by-unito
Copy link

sync-by-unito bot commented Jul 29, 2023

➤ michael-wb commented:

A fix for this has been committed to master, but didn't make it into this week's build. It will be included in the 04 August build.

@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.
Labels
Needs-Attention Reporter has responded. Review comment. O-Community
Projects
None yet
4 participants