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

@firebase/firestore: Firestore (10.5.0): FIRESTORE (10.5.0) INTERNAL ASSERTION FAILED: Unexpected state #7717

Closed
brianmhunt opened this issue Oct 19, 2023 · 13 comments

Comments

@brianmhunt
Copy link

[REQUIRED] Environment info

firebase-tools: 12.7.0

Platform:. Codespace/Ubuntu.

[REQUIRED] Test case

Unable to reproduce, sorry. Error emits from mutation:624 in serverTransformResults, specifically:

hardAssert(
    fieldTransforms.length === serverTransformResults.length,
    `server transform result count (${serverTransformResults.length}) ` +
      `should match field transform count (${fieldTransforms.length})`
  );
CleanShot 2023-10-19 at 13 10 45@2x

The stack trace does not show where this occurs.

[REQUIRED] Steps to reproduce

In our app when using the emulator this is occurring infrequently but regularly. It is a complex and we cannot easily narrow the trigger point.

It did not occur with 9.x.

[REQUIRED] Expected behavior

Firestore actions should perform

[REQUIRED] Actual behavior

Noted error.

Related: firebase/firebase-tools#1073

All we seem to see in the firestore-debug.log is:

Oct 19, 2023 5:11:27 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Oct 19, 2023 5:12:13 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Oct 19, 2023 5:12:28 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Oct 19, 2023 5:13:13 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
Oct 19, 2023 5:13:28 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.

I appreciate this may be difficult to reproduce but I wanted to at least note it for visibility and discovery. If we get more info we will share.

Thank you!

@kroikie kroikie transferred this issue from firebase/firebase-tools Oct 24, 2023
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@tom-andersen
Copy link
Contributor

Could you enable debug logging?
https://firebase.google.com/docs/reference/js/firestore_#setloglevel
https://firebase.google.com/docs/reference/node/firebase.firestore#setloglevel

The code seems to indicate that the Emulator is returning an unexpected result. Meaning, the root cause might exist in the emulator, and not the SDK. Some more information will help clarify that.

What version of the emulator are you using?

Some context might also be helpful. The error is related to data that is being written to Firestore. What type of write operations are you performing? Are these update, set or delete operations?

@brianmhunt
Copy link
Author

Thanks @tom-andersen, some direction would be helpful

We enabled setLogLevel from firebase/app but it does nothing. We're using firebase/app/compat everywhere else and there doesn't seem to be a setLogLevel equivalent for compat. Is there?

Also: how can we tell what version of the emulator we are using?

@brianmhunt
Copy link
Author

I would also note that we routinely see a case where doc.get fails:

await firestore.doc(fkp).get()

... simply never finishes. Reloading the browser is the only way to fix it, but it routinely comes back, and this is a catastrophic problem for a single page app.

@brianmhunt
Copy link
Author

Linking related firebase-tools/6432.

Also: we can reproduce and fixed this. It was related to a doc.get() being called for the same document many times in succession from different parts of our codebase.

We would expect that Firestore would queue these requests. We resolved it by adding a singleton/cache for the request.

@tom-andersen
Copy link
Contributor

The bug was introduced in 10.4.0. We are reverting the change and working on a long term fix.

I would also note that we routinely see a case where doc.get fails:

await firestore.doc(fkp).get()

... simply never finishes. Reloading the browser is the only way to fix it, but it routinely comes back, and this is a catastrophic problem for a single page app.

@tom-andersen
Copy link
Contributor

tom-andersen commented Oct 27, 2023

Sorry, seeing the current version isn't trivial.

Also: how can we tell what version of the emulator we are using?

What I really want to make sure is that you are running an up to date emulator.

If starting emulator with gcloud CLI, you can run:

gcloud components update

If starting emulator with firebase CLI, you can run:

firebase setup:emulators:firestore

@tom-andersen
Copy link
Contributor

We enabled setLogLevel from firebase/app but it does nothing. We're using firebase/app/compat everywhere else and there doesn't seem to be a setLogLevel equivalent for compat. Is there?

firebase/firestore-compat is wrapping code found in firebase/firestore. Ideally you should migrate away from using compat if possible. However, you still need to use the setLogLevel from within firebase/firestore to enable logging for Firestore, even if you are using compat.

@brianmhunt
Copy link
Author

Thanks for the great info @tom-andersen . We ought to be using a recent emulator because we routinely reinstall from a docker image for testing.

Is there anything actionable on this now? If we experience it again we can re-open, or we can leave it open and I will follow-up as we try new versions.

@MarkDuckworth
Copy link
Contributor

I would also note that we routinely see a case where doc.get fails ... simply never finishes.

I don't think this hanging doc.get call is related to the original issue reported, but I'd like to state that v10.5.2 released a fix for hanging queries.

@tom-andersen
Copy link
Contributor

@brianmhunt Yes, please let us know if you experience this again.

We need more context or debug info to make progress on this.

@google-oss-bot
Copy link
Contributor

Hey @brianmhunt. 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
Contributor

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

@brianmhunt 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 Dec 16, 2023
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

5 participants