WorryFree Computers   »   [go: up one dir, main page]

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

FIRESTORE INTERNAL ASSERTION FAILED: Trying to compare documents on fields that don't exist. (expected value1.has_value() && value2.has_value()) #9258

Closed
sspogra opened this issue Jan 25, 2022 · 50 comments

Comments

@sspogra
Copy link
sspogra commented Jan 25, 2022

[REQUIRED] Step 1: Describe your environment

  • Xcode version:13.1
  • Firebase SDK version:8.10.0
  • Installation method: CocoaPods
  • Firebase Component: Auth, Core, Database, Firestore, Messaging, Storage
  • Target platform(s): iOS

[REQUIRED] Step 2: Describe the problem

Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x9904c __exceptionPreprocess
1 libobjc.A.dylib 0x15f54 objc_exception_throw
2 Foundation 0x130834 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3 FirebaseFirestore 0x44868 (Missing)
4 FirebaseFirestore 0x44348 (Missing)
5 FirebaseFirestore 0x914b4 (Missing)
6 FirebaseFirestore 0x91554 (Missing)
7 FirebaseFirestore 0xd88a4 (Missing)
8 FirebaseFirestore 0xdf468 (Missing)
9 FirebaseFirestore 0x3b84c (Missing)
10 FirebaseFirestore 0x40650 (Missing)
11 FirebaseFirestore 0x40470 (Missing)
12 FirebaseFirestore 0x38920 (Missing)
13 FirebaseFirestore 0x38528 (Missing)
14 FirebaseFirestore 0x3836c (Missing)
15 FirebaseFirestore 0x121fec (Missing)
16 FirebaseFirestore 0x10bd58 (Missing)
17 FirebaseFirestore 0x10b860 (Missing)
18 FirebaseFirestore 0x68b18 (Missing)
19 FirebaseFirestore 0x5b40 (Missing)
20 FirebaseFirestore 0x1169c0 (Missing)
21 libdispatch.dylib 0x4660 _dispatch_client_callout
22 libdispatch.dylib 0xbde4 _dispatch_lane_serial_drain
23 libdispatch.dylib 0xc958 _dispatch_lane_invoke
24 libdispatch.dylib 0x171a8 _dispatch_workloop_worker_thread
25 libsystem_pthread.dylib 0x10f4 _pthread_wqthread
26 libsystem_pthread.dylib 0xe94 start_wqthread

Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x129754 __exceptionPreprocess
1 libobjc.A.dylib 0x287a8 objc_exception_throw
2 CoreFoundation 0x2b3f8 -[CFPrefsSearchListSource addManagedSourceForIdentifier:user:]
3 Foundation 0xd0a6c -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4 FirebaseFirestore 0x44868 (Missing)
5 FirebaseFirestore 0x44348 (Missing)
6 FirebaseFirestore 0x914b4 (Missing)
7 FirebaseFirestore 0x91554 (Missing)
8 FirebaseFirestore 0xd88a4 (Missing)
9 FirebaseFirestore 0xdf468 (Missing)
10 FirebaseFirestore 0x3b84c (Missing)
11 FirebaseFirestore 0x40650 (Missing)
12 FirebaseFirestore 0x40470 (Missing)
13 FirebaseFirestore 0x38920 (Missing)
14 FirebaseFirestore 0x38528 (Missing)
15 FirebaseFirestore 0x3836c (Missing)
16 FirebaseFirestore 0x121fec (Missing)
17 FirebaseFirestore 0x10bd58 (Missing)
18 FirebaseFirestore 0x10b860 (Missing)
19 FirebaseFirestore 0x68b18 (Missing)
20 FirebaseFirestore 0x5b40 (Missing)
21 FirebaseFirestore 0x1169c0 (Missing)
22 libdispatch.dylib 0x481c _dispatch_client_callout
23 libdispatch.dylib 0xc004 _dispatch_lane_serial_drain
24 libdispatch.dylib 0xcc00 _dispatch_lane_invoke
25 libdispatch.dylib 0x174bc _dispatch_workloop_worker_thread
26 libsystem_pthread.dylib 0x37a4 _pthread_wqthread
27 libsystem_pthread.dylib 0xa74c start_wqthread

Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x12a5f0 __exceptionPreprocess
1 libobjc.A.dylib 0x5bcc objc_exception_throw
2 CoreFoundation 0x2d7bc +[_CFXNotificationTokenRegistration keyCallbacks]
3 Foundation 0xd5134 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:]
4 FirebaseFirestore 0x44868 (Missing)
5 FirebaseFirestore 0x44348 (Missing)
6 FirebaseFirestore 0x914b4 (Missing)
7 FirebaseFirestore 0x91554 (Missing)
8 FirebaseFirestore 0xd88a4 (Missing)
9 FirebaseFirestore 0xdf468 (Missing)
10 FirebaseFirestore 0x3b84c (Missing)
11 FirebaseFirestore 0x40650 (Missing)
12 FirebaseFirestore 0x40470 (Missing)
13 FirebaseFirestore 0x38920 (Missing)
14 FirebaseFirestore 0x38528 (Missing)
15 FirebaseFirestore 0x3836c (Missing)
16 FirebaseFirestore 0x121fec (Missing)
17 FirebaseFirestore 0x10bd58 (Missing)
18 FirebaseFirestore 0x10b860 (Missing)
19 FirebaseFirestore 0x68b18 (Missing)
20 FirebaseFirestore 0x5b40 (Missing)
21 FirebaseFirestore 0x1169c0 (Missing)
22 libdispatch.dylib 0x5b524 _dispatch_client_callout
23 libdispatch.dylib 0x38b3c _dispatch_lane_serial_drain$VARIANT$armv81
24 libdispatch.dylib 0x3954c _dispatch_lane_invoke$VARIANT$armv81
25 libdispatch.dylib 0x4284c _dispatch_workloop_worker_thread
26 libsystem_pthread.dylib 0xbb74 _pthread_wqthread
27 libsystem_pthread.dylib 0xe740 start_wqthread

Steps to reproduce:

Three different crash log added above but all occurred on same condition. Basically crash happened when user update firestore document field value to "nil" while force close the app.

Relevant Code:

let fieldValue:Int? = nil
let updatedMap = ["number_field": fieldValue]
Firestore.firestore().collection("users")
.document(String(120))
.setData(updatedMap as [String : Any], merge: true)

@rizafran
Copy link
Contributor

Thanks for reporting, @sspogra. Based on the info you shared, it seems like there are lots of missing stack traces. To have a better understanding of the issue, could you provide the complete symbolicated stack trace?

@ehsannas ehsannas self-assigned this Jan 25, 2022
@sspogra
Copy link
Author
sspogra commented Jan 26, 2022

@rizafran We don't have full stack traces in firebase crashlytics.

@igorvoytovich
Copy link

We are also seeing the same crashes.
We can not reproduce locally, but several hundred appeared on the volumes among users. Approximately for 1% of users.

Appeared in recent versions of Firestore, this problem did not exist before.

@dconeybe
Copy link
Contributor
dconeybe commented Feb 7, 2022

I have poured over the code and talked with the team and we cannot figure out what could have caused this crash. And without symbolicated stack traces it's nearly impossible to guess what's going wrong. So to help with future debugging, I've improved the error message to include more information (#9305). When you start getting crash reports with this new message, please post the updates here.

@sspogra
Copy link
Author
sspogra commented Feb 8, 2022

@dconeybe We can get crash reports with this new message without update firebase sdk in app or need to update it?

@dconeybe
Copy link
Contributor
dconeybe commented Feb 8, 2022

You will need to update your app to point to a version of the Firebase SDK that contains the fix. Unfortunately, an official release that contains the fix won't be available for another month.

What you could do for now is to manually patch Firestore/core/src/core/order_by.cc with the changes in #9305. If you're using CocoaPods, then open Pods/FirebaseFirestore/Firestore/core/src/core/order_by.cc and patch in the change from #9305 (it's a straight-forward patch).

@paulb777 paulb777 added this to the 8.13.0 - M112 milestone Feb 8, 2022
@sspogra
Copy link
Author
sspogra commented Feb 9, 2022

ok thanks. I will do that and provide you feedback.

@dconeybe
Copy link
Contributor

@sspogra The improvement of the error message has been incorporated into version 8.12.1 of the iOS SDK, released on February 10, 2022. When you get a chance, upgrade your dependency to this new version and provide updated stack traces and error messages.

@sspogra
Copy link
Author
sspogra commented Feb 15, 2022

Thanks for the update @dconeybe

@ncooke3
Copy link
Member
ncooke3 commented Mar 8, 2022

Closing as this was fixed in a previous release.

@ncooke3 ncooke3 closed this as completed Mar 8, 2022
@dconeybe
Copy link
Contributor
dconeybe commented Mar 8, 2022

The issue is NOT fixed. I merely improved the error message to help diagnose the root cause.

@sspogra Once you have updated stack traces with the new version, please open a new GitHub issue for it.

@sspogra
Copy link
Author
sspogra commented Mar 21, 2022

@dconeybe Here is the stack traces with new firebase version 8.12.0....

Fatal Exception: NSInternalInconsistencyException
FIRESTORE INTERNAL ASSERTION FAILED: Trying to compare documents on fields that don't exist; field_path=name, lhs=users/17380, rhs=users/17380, value1.has_value()=false, value2.has_value()=false
0
CoreFoundation
__exceptionPreprocess
1
libobjc.A.dylib
objc_exception_throw
2
Foundation
-[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3
FirebaseFirestore
(Missing UUID c66ef36ca3fb349ab4cd0db34c5750dd)
25
libsystem_pthread.dylib
start_wqthread
Crashed: com.google.firebase.crashlytics.ios.exception
0x0000000000000000
0
FirebaseCrashlytics
FIRCLSProcessRecordAllThreads + 184
17
libsystem_pthread.dylib
start_wqthread + 8

@sspogra
Copy link
Author
sspogra commented Mar 21, 2022

Fatal Exception: NSInternalInconsistencyException
FIRESTORE INTERNAL ASSERTION FAILED: QueryComparator needs to have a key ordering. (expected has_key_ordering)
0
CoreFoundation
__exceptionPreprocess
1
libobjc.A.dylib
objc_exception_throw
2
Foundation
-[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3
FirebaseFirestore
(Missing UUID c66ef36ca3fb349ab4cd0db34c5750dd)
20
libsystem_pthread.dylib
start_wqthread

@dconeybe dconeybe reopened this Mar 21, 2022
@dconeybe
Copy link
Contributor

@sspogra Are you able to share the contents of the document users/17380 from the stack trace? If no, could you tell me if that document has its name field set to some value?

@dconeybe
Copy link
Contributor

@sspogra Forget that last comment. The field is __name__ but the underscores got replaced in the markdown formatting. That's the document name, which should ALWAYS have a value.

@google-oss-bot
Copy link

Hey @sspogra. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@sspogra if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@dconeybe
Copy link
Contributor

@sspogra Have you had a chance to test out the fix? I'm anxious to hear if it's fixed for you or if you're still experiencing this crash.

@sspogra
Copy link
Author
sspogra commented Apr 27, 2022

@dconeybe I will check this only when app release to app store. Our app will be release within 10 days. After that i can provide you feedback.

@dconeybe
Copy link
Contributor

Sounds good. Thanks for the update.

@dconeybe
Copy link
Contributor

@sspogra Are you still experiencing this crash?

@sspogra
Copy link
Author
sspogra commented May 31, 2022

@dconeybe App still not updated on app store with new firebase version. For now you can close this issue, I will comment here when my app was live on store.

@morganchen12 morganchen12 removed this from the 8.15.0 - M114 milestone May 31, 2022
@igorvoytovich
Copy link
igorvoytovich commented Jun 1, 2022

Hello @dconeybe ,

On Firebase 8.15.0 crash is still persist, but stack trace changed and here is the new one:

Crashed: com.google.firebase.firestore.rpc
0  grpc                           0xc0038 grpc_core::ParsedMetadata<grpc_metadata_batch>::KeyValueVTable(absl::lts_20211102::string_view)::'lambda'(grpc_core::Slice*, absl::lts_20211102::FunctionRef<void (absl::lts_20211102::string_view, grpc_core::Slice const&)>, grpc_core::ParsedMetadata<grpc_metadata_batch>*)::__invoke(grpc_core::Slice*, absl::lts_20211102::FunctionRef<void (absl::lts_20211102::string_view, grpc_core::Slice const&)>, grpc_core::ParsedMetadata<grpc_metadata_batch>*) + 137 (slice_refcount_base.h:137)
1  grpc                           0xc04e0 grpc_core::ParsedMetadata<grpc_metadata_batch>::WithNewValue(grpc_core::Slice, absl::lts_20211102::FunctionRef<void (absl::lts_20211102::string_view, grpc_core::Slice const&)>) const + 184 (parsed_metadata.h:184)
2  grpc                           0xb926c absl::lts_20211102::optional<grpc_core::ParsedMetadata<grpc_metadata_batch> > grpc_core::HPackParser::Parser::ParseIdxKey<grpc_core::HPackParser::String::Intern>(unsigned int) + 1145 (hpack_parser.cc:1145)
3  grpc                           0xb813c grpc_core::HPackParser::Parser::Parse() + 1004 (hpack_parser.cc:1004)
4  grpc                           0xb7f04 grpc_core::HPackParser::ParseInputInner(grpc_core::HPackParser::Input*) + 1334 (hpack_parser.cc:1334)
5  grpc                           0xb7da8 grpc_core::HPackParser::ParseInput(grpc_core::HPackParser::Input, bool) + 1308 (hpack_parser.cc:1308)
6  grpc                           0xb7adc grpc_core::HPackParser::Parse(grpc_slice const&, bool) + 1302 (hpack_parser.cc:1302)
7  grpc                           0xb84c8 grpc_chttp2_header_parser_parse(void*, grpc_chttp2_transport*, grpc_chttp2_stream*, grpc_slice const&, int) + 1381 (hpack_parser.cc:1381)
8  grpc                           0xf53a4 parse_frame_slice(grpc_chttp2_transport*, grpc_slice const&, int) + 626 (parsing.cc:626)
9  grpc                           0xf4f44 grpc_chttp2_perform_read(grpc_chttp2_transport*, grpc_slice const&) + 228 (parsing.cc:228)
10 grpc                           0x48374 read_action_locked(void*, grpc_error*) + 2415 (chttp2_transport.cc:2415)
11 grpc                           0x64e34 grpc_combiner_continue_exec_ctx() + 259 (error.h:259)
12 grpc                           0x884c4 grpc_core::ExecCtx::Flush() + 167 (exec_ctx.cc:167)
13 grpc                           0x84ee4 pollset_work(grpc_pollset*, grpc_pollset_worker**, long long) + 1096 (ev_poll_posix.cc:1096)
14 grpc                           0x86a10 pollset_work(grpc_pollset*, grpc_pollset_worker**, long long) + 323 (ev_posix.cc:323)
15 grpc                           0x69da0 cq_next(grpc_completion_queue*, gpr_timespec, void*) + 1047 (completion_queue.cc:1047)
16 grpcpp                         0x1a46c grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) + 147 (completion_queue_cc.cc:147)
17 FirebaseFirestore              0x2d89c firebase::firestore::remote::Datastore::PollGrpcQueue() + 141 (datastore.cc:141)
18 FirebaseFirestore              0x13422c firebase::firestore::util::Task::ExecuteAndRelease() + 491 (function.h:491)
19 libdispatch.dylib              0x3db0 _dispatch_client_callout + 20
20 libdispatch.dylib              0xb10c _dispatch_lane_serial_drain + 580
21 libdispatch.dylib              0xbc5c _dispatch_lane_invoke + 408
22 libdispatch.dylib              0x15d78 _dispatch_workloop_worker_thread + 708
23 libsystem_pthread.dylib        0x3804 _pthread_wqthread + 276
24 libsystem_pthread.dylib        0xa75c start_wqthread + 8

P.S.

Perhaps this is a completely new crash not related to the one we are talking about, but after the update, the crash we were talking about disappeared, and this one appeared. From this I concluded that the problem did not go away, just the stack trace changed.

@dconeybe
Copy link
Contributor
dconeybe commented Jun 2, 2022

@igorvoytovich Thanks for the updated stack trace. My guess is that my fix #9550 fixed the original crash, and now it's gotten past the point where it was previously crashing and is now crashing in a different place. Since it's not clear, I'd like to treat it as a new issue. Would you mind opening a new issue with this new stack trace? Even if it's related, it's going to require its own investigation.

Also, you mentioned in your older comment (#9258 (comment)) that you were getting "hundreds" of reports of the old crash. Do you still get any reports of the old stack trace after upgrading to 8.15.0? Or are all of your crashes this "new" stack trace since upgrading to 8.15.0?

@igorvoytovich
Copy link

Hi @dconeybe ,

Thanks for your response.

The old crash (Trying to compare documents on fields that don't exist.) completely disappeared. Yes, all of our crashes is now with this "new" stack trace.

I will open a new issue now.

Thank you for your help!

@dconeybe
Copy link
Contributor
dconeybe commented Jun 2, 2022

@igorvoytovich Thanks for the info. That gives a pretty strong indicator that the crash is fixed. I'll wait for @sspogra to reply to see if the crash resolution is confirmed.

@google-oss-bot
Copy link

Hey @sspogra. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@sspogra if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Jul 16, 2022
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

9 participants