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

ConnectivityMonitorApple::OnReachabilityChanged callbacks on the wrong queue #3661

Closed
ghost opened this issue Aug 23, 2019 · 10 comments · Fixed by #3663
Closed

ConnectivityMonitorApple::OnReachabilityChanged callbacks on the wrong queue #3661

ghost opened this issue Aug 23, 2019 · 10 comments · Fixed by #3663
Assignees

Comments

@ghost
Copy link

ghost commented Aug 23, 2019

[READ] Step 1: Are you in the right place?

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 10.3
  • Firebase SDK version: 6.7.0
  • Firebase Component: Firestore
  • Component version: 1.4.4

[REQUIRED] Step 3: Describe the problem

Firestore crashes when trying to write data

Steps to reproduce:

Don't have exact steps. Stack trace:

Fatal Exception: NSInternalInconsistencyException
FIRESTORE INTERNAL ASSERTION FAILED: Expected to be called by the executor associated with this queue (expected executor: 'com.google.firebase.firestore', actual executor: 'com.apple.main-thread') (expected executor_->IsCurrentExecutor())

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x18763e98c __exceptionPreprocess
1  libobjc.A.dylib                0x1868179f8 objc_exception_throw
2  CoreFoundation                 0x187558098 +[_CFXNotificationTokenRegistration keyCallbacks]
3  Foundation                     0x188068de8 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4  Smart Home                     0x103830750 firebase::firestore::util::internal::Fail(char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
5  Smart Home                     0x103830868 firebase::firestore::util::internal::Fail(char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*)
6  Smart Home                     0x103789040 firebase::firestore::util::AsyncQueue::VerifyIsCurrentExecutor() const
7  Smart Home                     0x1037891b0 firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&)
8  Smart Home                     0x10378fad4 firebase::firestore::remote::ConnectivityMonitorApple::OnReachabilityChanged(unsigned int)
9  SystemConfiguration            0x1883b0118 reachPerformAndUnlock
10 libdispatch.dylib              0x18707ca38 _dispatch_call_block_and_release
11 libdispatch.dylib              0x18707d7d4 _dispatch_client_callout
12 libdispatch.dylib              0x18705d9e4 _dispatch_main_queue_callback_4CF$VARIANT$armv81
13 CoreFoundation                 0x1875d032c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation                 0x1875cb264 __CFRunLoopRun
15 CoreFoundation                 0x1875ca7c0 CFRunLoopRunSpecific
16 GraphicsServices               0x1897cb79c GSEventRunModal
17 UIKitCore                      0x1b3f87c38 UIApplicationMain
18 Smart Home                     0x102f8b6c0 main (<compiler-generated>)
19 libdyld.dylib                  0x18708e8e0 start

Relevant Code:

My Firestore database initialization is going on a dedicated dispatch queue and my write requests also run in the same queue. So, for the Firestore I always use one exact dispatch queue.

// very simplified version of my firestore app usage

let dispatchQueue =  DispatchQueue(label: "my label", qos: .userInitiated)

dispatchQueue.async {
// then lazy property initialize Firestore on this queu
  
private lazy var db: Firestore = {
        let db = Firestore.firestore()
        db.settings.dispatchQueue = self.dispatchQueue
        return db
    }()

// then on this queue I'm creating document references and trying to write data

let document = db.collection("some").document("some")
document.setData([id: json],
                                 merge: true)
            }
@jangsy7883
Copy link

I had the same problem.

@pradipaub36
Copy link

I got the same crash after the update Firebase SDKs to the latest version v6.7.0

@wilhuff wilhuff changed the title Firestore crash (FIRESTORE INTERNAL ASSERTION FAILED: Expected to be called by the executor associated with this queue (expected executor: 'com.google.firebase.firestore', actual executor: 'com.apple.main-thread') (expected executor_->IsCurrentExecutor())) Aug 23, 2019
@wilhuff
Copy link
Contributor

wilhuff commented Aug 23, 2019

Thanks for the report. We're looking into this now.

@wilhuff
Copy link
Contributor

wilhuff commented Aug 23, 2019

We've released FirebaseFirestore 1.4.5 via CocoaPods which fixes this issue.

We're still working on respinning the zip release and Carthage binaries. For now if you're using those methods, please use Firebase 6.6.0.

@paulb777
Copy link
Member

The 6.7.1 version of the zip distribution and a Firestore 6.7.1 Carthage module are available.

@pradipaub36
Copy link

How could we get the zip file?

@ryanwilson
Copy link
Member

You can find the zip file from the Firebase setup instructions. I'll upload the 6.7.1 zip to GitHub Releases shortly as well.

@ryanwilson
Copy link
Member

Update: the zip file is also available as a GitHub Release.

https://github.com/firebase/firebase-ios-sdk/releases/tag/6.7.1

@pradipaub36
Copy link

@ryanwilson When will you update the stable version in cocoapods to 6.7.1?

@paulb777
Copy link
Member

paulb777 commented Sep 3, 2019

@pradipaub36 6.7.1 is a zip and Carthage version update only.

For CocoaPods, since the actual fix is in the Firestore pod, it's sufficient to run pod update on Firebase 6.7.0 and update FirebaseFirestore to 1.4.5

@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
6 participants