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

[URGENT] Performance bug in Edge, Firefox #461

Closed
iamart opened this issue Jan 23, 2018 · 17 comments
Closed

[URGENT] Performance bug in Edge, Firefox #461

iamart opened this issue Jan 23, 2018 · 17 comments
Assignees

Comments

@iamart
Copy link

iamart commented Jan 23, 2018

Querying firestore collections and documents in Edge browser is either instant or with a 30s delay about every other time you load the app; Firefox fails completely.

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Firebase SDK version: 4.9.0
  • Firebase Product: firestore
  • Affected browsers: Edge 15+, Firefox 52+

[REQUIRED] Describe the problem

Steps to reproduce:

  1. create collection 'channels'
  2. apply read permissions to it
    match /channels/{document=**} { allow read; }
  3. connect to firestore by filling up database config in app/app.component.ts
  4. refresh the output window and observe how long it would take for the response to come. (might take few tries)

Relevant Code:

https://stackblitz.com/edit/angular-xldoe5

@iamart
Copy link
Author

iamart commented Jan 29, 2018

updated the sample stripping irrelevant code.
After few tests I can confirm this is not exclusive to collections, doc() has the same issue,

@iamart iamart changed the title Performance bug in Edge Jan 29, 2018
@sampsonjoliver
Copy link

sampsonjoliver commented Jan 30, 2018

I've also seen some serious performance issues with Edge also. Sometimes it is on par with Chrome (so almost instantaneous), and other times it is anywhere from 30s to 2min to forever.

Have not tested within Firefox. Chrome works and behaves perfectly. I suspect this has started more recently (in the past few months), either just due to the type of queries I've used more recently, or due to firestore/edge updates. I don't have the time to investigate which atm unfortunately.

@atlanteh
Copy link

atlanteh commented Mar 19, 2018

For whoever this may help..
I have an issue with Edge on latest 4.11.0 firebase version. I have contacted google support team almost 3 months ago, and they are still investigating this. They asked for a simple project to validate that the issue is theirs and not another library, and whil investigating I noticed the following:

  1. When running firebase using webpack edge is almost always slow
  2. When using a <script> tag, edge is fast as other browsers.

Since I'm running a very simple build of webpack. I'm suspecting there's some problem with the node build of firebase which causes this issue.

@mikelehen
Copy link
Contributor

FYI- This is on our radar (I've been working with support on your case) and we are looking into it. Regarding the support request from 3 months ago, there was a specific issue with Edge that we addressed in 4.10.0 (https://firebase.google.com/support/release-notes/js#4.10.0).

I'm unsure if this new issue is related and it seems to be much harder to reproduce. In the repro I have, it only happens around 1 out of 5 times and as you noticed it only happens after compiling with webpack, which suggests it may be some sort of minification bug (FYI- the node build wouldn't work at all in a browser, so that's not the issue).

If anybody has a minimal (without webpack) or more consistent repro (happens every time), that would be extremely helpful. Else, I'm looking into it, but it's going to take some time to isolate.

@atlanteh
Copy link

The repro I provided you runs webpack in the minimal way, which only bundle the files, but without actual code transformation, so there's no minification here.
Maybe you can try Browserify to see if there's any change? If not, then it's almost for sure the nodejs build.
Can you check if there's any significant changes between the browser build and the nodejs one?

@mikelehen
Copy link
Contributor

Ahh, thanks for pointing that out. I hadn't looked at your latest repro yet (I had independently found that using the CDN assets from gstatic didn't reproduce the problem). That is indeed interesting.

I think when you say "nodejs" you're probably generically referring to our npm package, but it actually contains both a browser version and a nodejs version:

"main": "index.node.js",

And the two are quite different. Using the nodejs code in a browser wouldn't work at all. :-) As for the difference between the npm package code and the CDN code, that is a good question. They come from the same sources, but the CDN code is bundled and minified, etc.

I'll continue to investigate. Thanks.

@ringcraig
Copy link

I am also running into this issue with an updated version of firebase. Using the vanilla create-react-app, which does run webpack. This issue occurs for me every time in edge. https://youtu.be/lyPEY_F9nEs

Locally the call times out. When deployed here it takes about thirty seconds.

This is the call that is hanging for me:

    db.collection('users').doc(this.state.userId).get()
      .then((userDoc) => {
        const user = userDoc.data()
        if (user.assessments) {
          if (user.assessments[assessmentId]) {
            const userAssessmentId = user.assessments[assessmentId].userAssessmentId
            db.collection('userAssessments').doc(userAssessmentId).get()
              .then((userAssessmentDoc) => {
                const userAssessment = userAssessmentDoc.data()
                this.props.assessmentInitializeSuccess(userAssessment)
              })
              .catch((err) => this.props.assessmentInitializeError(err))
          } 
        }  
      })
      .catch((err) => this.props.assessmentInitializeError(err))

Let me know if you'd like to see more code for a repro.

@mikelehen
Copy link
Contributor

So I think I figured out what's going on. This is the same bug that we investigated / fixed before (fixed by #509), but we didn't release a new version of @firebase/webchannel-wrapper... so if you're building with webpack you didn't get the fix. But if you used the prebuilt client (firebase-firestore.js) you did get the fix.

I'll work with @jshcrowthe to get this resolved.

@mikelehen
Copy link
Contributor

One note though: The fix that was made is only applicable to Edge. If anybody is seeing issues with Firefox, please open a separate issue.

@atlanteh
Copy link

Awesome! Thx for all of your hard work!

@thsbrown
Copy link

Thanks so much for working through this! This is quite a big bug that I just stumbled upon when testing my application on Edge. Let me know if I can do anything to help 👍

@mikelehen
Copy link
Contributor

You're welcome. :-) We believe everything should be fixed in our next release, targeted for Thursday. You can npm install firebase@next to get the prerelease bits for testing if you like.

@iamart
Copy link
Author

iamart commented Mar 29, 2018

I caught the issue on Firefox by suprise while testing the bug on browserstack. I'll run more tests and will close the issue if nothing else comes up.

@atlanteh
Copy link

Please wait until the new release is published :)

@iamart
Copy link
Author

iamart commented Apr 3, 2018

edge 15-16: pass;
firefox 52-57: 10s delay
firefox 58+: pass.

Since the latest version of firefox are passing the test will consider the issue to be fixed.

@BensenEm
Copy link

A similar problem is existing in Internet Explorer 11.
Does anyone know if this issue is beeing worked on?

@mikelehen
Copy link
Contributor

This issue has been closed for months and I'm not aware of any active IE or Edge performance issues being tracked. Please open a new issue with as much detail as possible about what you're expecting and what you're seeing. Thanks!

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