realm-swift icon indicating copy to clipboard operation
realm-swift copied to clipboard

RLMSessionDelegate crash

Open anton-plebanovich opened this issue 1 year ago • 4 comments

How frequently does the bug occur?

Seen once

Description

We got one crash report in the Crashlytics

Stacktrace & log output

EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000010000
Crashed: com.apple.NSURLSession-delegate
0  Divtracker                     0x3f5748 realm::util::UniqueFunction<void (realm::util::Optional<realm::app::AppError>)>::SpecificImpl<realm::app::App::handle_auth_failure(realm::app::AppError const&, realm::app::Response const&, realm::app::Request&&, std::__1::shared_ptr<realm::SyncUser> const&, realm::util::UniqueFunction<void (realm::app::Response const&)>&&)::$_10>::call(realm::util::Optional<realm::app::AppError>&&) + 260276
1  Divtracker                     0x3f5a5c realm::util::UniqueFunction<void (realm::app::Response const&)>::SpecificImpl<realm::app::App::refresh_access_token(std::__1::shared_ptr<realm::SyncUser> const&, realm::util::UniqueFunction<void (realm::util::Optional<realm::app::AppError>)>&&)::$_11>::call(realm::app::Response const&) + 261064
2  Divtracker                     0x9671cc invocation function for block in (anonymous namespace)::CocoaNetworkTransport::send_request_to_server(realm::app::Request&&, realm::util::UniqueFunction<void (realm::app::Response const&)>&&) + 1459 (string:1459)
3  Divtracker                     0x9a1b88 -[RLMSessionDelegate URLSession:task:didCompleteWithError:] + 167 (RLMNetworkTransport.mm:167)
4  CFNetwork                      0x1a734 CFURLRequestCopyHTTPRequestMethod + 2264
5  libdispatch.dylib              0x25d4 _dispatch_call_block_and_release + 32
6  libdispatch.dylib              0x40fc _dispatch_client_callout + 20
7  libdispatch.dylib              0xb7b4 _dispatch_lane_serial_drain + 672
8  libdispatch.dylib              0xc334 _dispatch_lane_invoke + 436
9  libdispatch.dylib              0x16ec4 _dispatch_workloop_worker_thread + 652
10 libsystem_pthread.dylib        0xdf8 _pthread_wqthread + 288
11 libsystem_pthread.dylib        0xb98 start_wqthread + 8

Can you reproduce the bug?

Not yet

Reproduction Steps

Realm function was called and for some reason, it caused a crash on didCompleteWithError

Version

10.28.1

What SDK flavour are you using?

MongoDB Realm (i.e. Sync, auth, functions)

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS 16.0.0

Build environment

Xcode version: 13.4.1 Dependency manager and version: 1.11.3

anton-plebanovich avatar Aug 04 '22 04:08 anton-plebanovich

I tried reproducing this by disabling a user just before calling a function and had no luck. I wonder if this is something specific to iOS 16, on what version of the iOS 16 beta did this crash occur?

leemaguire avatar Aug 09 '22 09:08 leemaguire

Hi @leemaguire I don't know which iOS beta it is since Crashlytics reported the iOS version as 16.0.0 without any suffixes or prefixes.

According to logs, it was a complicated case when a user didn't have an internet connection for some time, the app allows reconnecting in such cases by releasing all open Realm, User, and App (we also reset apps cache), waiting some time, and then instantiating everything again. There was also an ongoing function call since there is no ability to cancel ongoing function requests so might be some sort of race conditions + unexpected state. Could be an iOS 16.0.0 issue also since 0.0 versions usually have a lot of strange crashes.

Mostly, just wanted to keep you informed. This one looks pretty minor for us so if there are no reports from other developers it may be closed.

anton-plebanovich avatar Aug 15 '22 14:08 anton-plebanovich

We will revisit this issue once iOS 16 RC is released.

leemaguire avatar Aug 25 '22 10:08 leemaguire

➤ Lee Maguire commented:

Revisit once iOS 16 is out

sync-by-unito[bot] avatar Aug 25 '22 10:08 sync-by-unito[bot]