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 in Firebase 5.20.0 #2682

Closed
yusuftor opened this issue Mar 29, 2019 · 12 comments · Fixed by #2686
Closed

Crash in Firebase 5.20.0 #2682

yusuftor opened this issue Mar 29, 2019 · 12 comments · Fixed by #2686
Milestone

Comments

@yusuftor
Copy link

  • Xcode version: 10.2
  • Firebase SDK version: 5.20.0

Having just updated to Firebase 5.20.0, the app now crashes when I run it.Here is the stack track for the thread that it crashes in:

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x000000010d77c13f in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:1406
#1	0x000000010d77c13c in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer() const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:1500
#2	0x000000010d77c13c in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data() const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:1228
#3	0x000000010d77c13c in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator std::__1::basic_string_view<char, std::__1::char_traits<char> >() const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:869
#4	0x000000010d77c13c in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:3656
#5	0x000000010d77c13c in bool std::__1::operator<<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:3881
#6	0x000000010d77c13c in std::__1::__less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:721
#7	0x000000010d77c102 in bool std::__1::__lexicographical_compare<std::__1::__less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*> >(std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:5676
#8	0x000000010d7b6a7a in bool std::__1::lexicographical_compare<std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:5696
#9	0x000000010d7b6a71 in bool std::__1::lexicographical_compare<std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*> >(std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>, std::__1::__wrap_iter<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*>) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:5706
#10	0x000000010d7b6a71 in bool std::__1::operator<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/vector:3359
#11	0x000000010d7b6a63 in firebase::firestore::model::impl::BasePath<firebase::firestore::model::ResourcePath>::operator<(firebase::firestore::model::impl::BasePath<firebase::firestore::model::ResourcePath> const&) const [inlined] at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/model/base_path.h:159
#12	0x000000010d7b6a63 in firebase::firestore::model::ResourcePath::operator<(firebase::firestore::model::ResourcePath const&) const [inlined] at /Users/Yusuf2/Documents/iPhone MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/model/resource_path.h:66
#13	0x000000010d7b6a63 in firebase::firestore::model::operator<(firebase::firestore::model::DocumentKey const&, firebase::firestore::model::DocumentKey const&) [inlined] at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/model/document_key.h:108
#14	0x000000010d7b6a3d in std::__1::less<firebase::firestore::model::DocumentKey>::operator()(firebase::firestore::model::DocumentKey const&, firebase::firestore::model::DocumentKey const&) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__functional_base:55
#15	0x000000010d7b6a3d in firebase::firestore::immutable::KeyComparator<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >::operator()(std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const&, firebase::firestore::model::DocumentKey const&) const [inlined] at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/immutable/map_entry.h:47
#16	0x000000010d7b6a3d in std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const* std::__1::__lower_bound<firebase::firestore::immutable::KeyComparator<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >&, std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, firebase::firestore::model::DocumentKey>(std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, firebase::firestore::model::DocumentKey const&, firebase::firestore::immutable::KeyComparator<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:4201
#17	0x000000010d7c3be0 in std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const* std::__1::lower_bound<std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, firebase::firestore::model::DocumentKey, firebase::firestore::immutable::KeyComparator<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> > >(std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, std::__1::pair<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong> const*, firebase::firestore::model::DocumentKey const&, firebase::firestore::immutable::KeyComparator<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:4223
#18	0x000000010d7c3bd5 in firebase::firestore::immutable::impl::ArraySortedMap<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >::lower_bound(firebase::firestore::model::DocumentKey const&) const [inlined] at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h:274
#19	0x000000010d7c3bd5 in firebase::firestore::immutable::impl::ArraySortedMap<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >::find(firebase::firestore::model::DocumentKey const&) const at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h:245
#20	0x000000010d7c2998 in firebase::firestore::immutable::SortedMap<firebase::firestore::model::DocumentKey, FSTMaybeDocument* __strong, firebase::firestore::util::Comparator<firebase::firestore::model::DocumentKey> >::find(firebase::firestore::model::DocumentKey const&) const at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/immutable/sorted_map.h:234
#21	0x000000010d726edc in firebase::firestore::model::DocumentSet::GetDocument(firebase::firestore::model::DocumentKey const&) const at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/model/document_set.mm:70
#22	0x000000010d725e27 in firebase::firestore::api::DocumentReference::AddSnapshotListener(firebase::firestore::core::ListenOptions, std::__1::unique_ptr<firebase::firestore::core::EventListener<firebase::firestore::api::DocumentSnapshot>, std::__1::default_delete<firebase::firestore::core::EventListener<firebase::firestore::api::DocumentSnapshot> > >&&)::Converter::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>) at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/api/document_reference.mm:219
#23	0x000000010d74353f in firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()::operator()() const [inlined] at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/event_listener.h:135
#24	0x000000010d743508 in decltype(std::__1::forward<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&>(fp)()) std::__1::__invoke<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&>(firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4339
#25	0x000000010d743508 in void std::__1::__invoke_void_return_wrapper<void>::__call<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&>(firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__functional_base:349
#26	0x000000010d72d792 in std::__1::function<void ()>::operator()() const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1913
#27	0x000000010d72d783 in firebase::firestore::util::internal::DispatchAsync(NSObject<OS_dispatch_queue>*, std::__1::function<void ()>&&)::$_0::operator()(void*) const [inlined] at /MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/util/executor_libdispatch.mm:57
#28	0x000000010d72d783 in firebase::firestore::util::internal::DispatchAsync(NSObject<OS_dispatch_queue>*, std::__1::function<void ()>&&)::$_0::__invoke(void*) at MyApp/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/util/executor_libdispatch.mm:55
#29	0x0000000117517db5 in _dispatch_client_callout ()
#30	0x0000000117525080 in _dispatch_main_queue_callback_4CF ()
#31	0x00000001113428a9 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#32	0x000000011133cf56 in __CFRunLoopRun ()
#33	0x000000011133c302 in CFRunLoopRunSpecific ()
#34	0x0000000118cc52fe in GSEventRunModal ()
#35	0x000000011e64fba2 in UIApplicationMain ()
#36	0x000000010d60465b in main at AppDelegate.swift:28
#37	0x000000011758c541 in start ()

It didn't crash in the previous version, all I've done is update Pods to the latest versions.

@google-oss-bot

This comment has been minimized.

@wilhuff
Copy link
Contributor

wilhuff commented Mar 29, 2019

I'm sorry to hear that and sorry for the trouble.

Can you think of anything interesting about the query you're running or the data you're running it against?

We might get some clues if you enable logging and post the results (or send them to [email protected]).

@AlexisBarreyat
Copy link

Similar issue after a manual update using Carthage.

@mikelehen
Copy link
Contributor

@AlexisBarreyat Thanks for chiming in. We're still looking for details on what kind of query triggers the error, and ideally debug logs (see #2682 (comment)).

@StarLard
Copy link

StarLard commented Mar 30, 2019

Experiencing this crash as well. Seems to be happening across document snapshot listeners, get document calls, and possibly more.

Nearly positive this query is one such throwing call:

Database
                .instance
                .collection(User.databaseCollection)
                .document(userId)
                .getDocument { (documentSnapshot, error) in
                    if let error = error {
                        observer.onError(error)
                    } else if let document = documentSnapshot {
                        do {
                            let user: User = try DatabaseMapper.map(document)
                            observer.onNext(user)
                        } catch {
                            observer.onError(error)
                        }
                    }
            }

Stack trace:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7473696c78)
  * frame #0: 0x000000010d8fc39b Map2Next`long std::__1::__libcpp_atomic_refcount_increment<long>(__t=0x0000007473696c78) at memory:3475:12
    frame #1: 0x000000010d8fc369 Map2Next`std::__1::__shared_count::__add_shared(this=0x0000007473696c70) at memory:3535:7
    frame #2: 0x000000010d8fc345 Map2Next`std::__1::__shared_weak_count::__add_shared(this=0x0000007473696c70) at memory:3574:23
    frame #3: 0x000000010d8fc326 Map2Next`std::__1::shared_ptr<firebase::firestore::model::ResourcePath const>::shared_ptr(this=0x00007ffee2807b40, __r=std::__1::shared_ptr<const firebase::firestore::model::ResourcePath>::element_type @ 0x2e5f544246435f0c strong=1 weak=1) at memory:4191:19
    frame #4: 0x000000010d8fc2cd Map2Next`std::__1::shared_ptr<firebase::firestore::model::ResourcePath const>::shared_ptr(this=0x00007ffee2807b40, __r=std::__1::shared_ptr<const firebase::firestore::model::ResourcePath>::element_type @ 0x2e5f544246435f0c strong=1 weak=1) at memory:4189:1
    frame #5: 0x000000010d8fc29d Map2Next`firebase::firestore::model::DocumentKey::DocumentKey(this=0x00007ffee2807b40, (null)=0x0000600002f01e30) at document_key.h:41:7
    frame #6: 0x000000010d8fb78d Map2Next`firebase::firestore::model::DocumentKey::DocumentKey(this=0x00007ffee2807b40, (null)=0x0000600002f01e30) at document_key.h:41:7
    frame #7: 0x000000010d8c275e Map2Next`firebase::firestore::api::DocumentReference::AddSnapshotListener(this=0x0000600002f017e0, maybe_snapshot=StatusOr<firebase::firestore::core::ViewSnapshot> @ 0x00007ffee2807d10)::Converter::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>) at document_reference.mm:214:25
    frame #8: 0x000000010d93096a Map2Next`firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(this=0x00007ffa6d9bb338)::'lambda'()::operator()() const at event_listener.h:135:31
    frame #9: 0x000000010d93088d Map2Next`decltype(__f=0x00007ffa6d9bb338)::'lambda'()&>(fp)()) std::__1::__invoke<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&>(firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&) at type_traits:4339:1
    frame #10: 0x000000010d93083d Map2Next`void std::__1::__invoke_void_return_wrapper<void>::__call<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(__args=0x00007ffa6d9bb338)::'lambda'()&>(firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&) at __functional_base:349:9
    frame #11: 0x000000010d92f761 Map2Next`std::__1::__function::__func<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'(), std::__1::allocator<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()>, void ()>::operator(this=0x00007ffa6d9bb330)() at functional:1562:12
    frame #12: 0x000000010d9774e5 Map2Next`std::__1::function<void ()>::operator(this=0x00006000023b9a70)() const at functional:1913:12
    frame #13: 0x000000010d8dd2a1 Map2Next`firebase::firestore::util::internal::DispatchAsync(this=0x00006000023b9a70, raw_work=0x00006000023b9a70)>&&)::$_0::operator()(void*) const at executor_libdispatch.mm:57:5
    frame #14: 0x000000010d8dd275 Map2Next`firebase::firestore::util::internal::DispatchAsync(raw_work=0x00006000023b9a70)>&&)::$_0::__invoke(void*) at executor_libdispatch.mm:55:33
    frame #15: 0x0000000115e96db5 libdispatch.dylib`_dispatch_client_callout + 8
    frame #16: 0x0000000115ea4080 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1540
    frame #17: 0x0000000113e098a9 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    frame #18: 0x0000000113e03f56 CoreFoundation`__CFRunLoopRun + 2310
    frame #19: 0x0000000113e03302 CoreFoundation`CFRunLoopRunSpecific + 626
    frame #20: 0x000000011a8002fe GraphicsServices`GSEventRunModal + 65
    frame #21: 0x000000011d215ba2 UIKitCore`UIApplicationMain + 140
    frame #22: 0x000000010d4b225b Map2Next`main at AppDelegate.swift:17:7
    frame #23: 0x0000000115f0b541 libdyld.dylib`start + 1

@wilhuff
Copy link
Contributor

wilhuff commented Mar 30, 2019

We think we've isolated the issue. The problem is a lifetime issue in the underlying C++, where if the snapshot listener outlives the document reference, the callback can read memory that's been freed.

I'm currently working on a fix.

For now, pin to 5.19.

@wilhuff
Copy link
Contributor

wilhuff commented Mar 30, 2019

@yusuftor, @AlexisBarreyat, @ccfriden: We have a fix available in #2686.

You can use it without waiting for an official release by adding the following to your Podfile:

pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'pull/2686/head'
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'pull/2686/head'

I'm hoping we can spin a new release of the Firebase pod shortly, but if this works for you, let us know.

@wilhuff wilhuff closed this as completed Mar 30, 2019
@paulb777 paulb777 added this to the 5.20.1 milestone Mar 30, 2019
@heumn
Copy link

heumn commented Mar 30, 2019

That didn't work for me. To fetch 5.19 I had to specify the 5.19.0 version:

pod 'Firebase/Core', '5.19.0'
pod 'Firebase/Firestore', '5.19.0'

May I propose to keep this issue open until a new version is released? People probably shouldn't have to dig into closed issues for crashes that are still relevant for the most recent version 🤔

@paulb777
Copy link
Member

To get the fix now, try

pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :commit => '293c5c2'
pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :commit => '293c5c2'

Note there are no slashes in the pod names.

I'll make an exception to our usual policy and keep this issue open after the fix and until the release to increase findability.

@paulb777 paulb777 reopened this Mar 30, 2019
@nitrag
Copy link

nitrag commented Mar 30, 2019

Ouch, big bug. Yea crashing for me too on document.data() fo DocumentSnapshot.

@paulb777 your commits fixed the issue. Thanks!

@paulb777
Copy link
Member

Thanks for the confirmation @nitrag. We're working on publishing the fix today.

@paulb777
Copy link
Member

We've now published a Firebase 5.20.1 release to CocoaPods that includes version 1.2.1 of FirebaseFirestore with the fix.

There is also a Firestore version 5.20.1 Carthage update. (All other Carthage versions remain at 5.20.0)

The zip file package is available for download at https://github.com/firebase/firebase-ios-sdk/releases/tag/5.20.1

The web site release notes and zip link will be updated later this week.

@firebase firebase locked and limited conversation to collaborators Oct 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants