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

JS networking blocked on FF after Riot has been in a background tab for a while #7858

Open
zzottel opened this issue Dec 13, 2018 · 15 comments
Labels
A-Performance P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@zzottel
Copy link

zzottel commented Dec 13, 2018

After using Riot Web in Firefox (63.0.3 now, but also in earlier versions) over a longer time (several hours), often switching rooms etc., Riot becomes slower and slower.

It often hangs, e.g. while loading room members or avatars, for half a minute or a minute, and then suddenly everything is populated very quickly.

It's not Synapse, though, Riot Android used at the same time doesn't show the same slowness, and after an FF restart, Riot Web is much faster again.

I thought this was #7105, but while it has become quite a bit better since that bug has been fixed, the behaviour is still there. When #7105 was still unfixed, the complete FF would become unusable after some time, and quite quickly. Now, the rest of FF is often (not always) usable without problems. EDIT: Not sure if this is true, maybe I only restart FF earlier than before, see the first comment below.

After some time of growing slowness, Riot states that it has lost the connection to the homeserver (while Synapse is in truth running happily). At this point, switching to another tab using an FF extension (Tree Style Tab) often only works after half a minute or so (but switching tabs using the tabs on top still works). Reloading or Shift-Reloading the Riot tab doesn't work, only goes into loading state without changing the tab contents or replaces the tab contents with white only, but doesn't load anything.

A restart of Firefox fixes that, though after switching to the Riot tab, almost always "Missing Translation"s are shown, see #7847, until I reload the tab. After that Riot Web is snappy again for a while.

While watching Synapse logs and network console in FF, it seemed to me that there might be requests to Synapse that are only answered after a very long time or even never, but Riot Web won't close those, and will only use a certain number of concurrent requests to Synapse. As the number of never-answered requests grows, the number of connections used for actual work goes down, until Riot Web can't even sync anymore.

I'm not at all sure if I interpreted that correctly, though; might be something else entirely.

@zzottel
Copy link
Author

zzottel commented Dec 14, 2018

Some further notes:

  • Yesterday in the evening, Riot and with it FF became unusable without Riot saying it had lost the connection to the homeserver. It just didn't do anything anymore except showing spinners. Switching rooms was still possible, but nothing new (like avatars, room updates) was loaded there.
  • Another JS-heavy Webapp (Zimbra mail client) didn't work anymore at that point, too, i.e. I couldn't open an email I had received, and after some time trying to load it, it showed a dialog telling me that the network or the server was not reacting. So it seems as if the whole Firefox is running out of connections to use?

@jryans
Copy link
Collaborator

jryans commented Dec 14, 2018

I am sorry to hear you are having this slowdown. I think some more detail about your system configuration may be helpful. Since you're using Firefox, can you go to about:telemetry#environment-data-tab_system and copy the data listed there?

@zzottel
Copy link
Author

zzottel commented Dec 14, 2018

Eigenschaft Wert
memoryMB 15927
virtualMaxMB null
cpu.count 4
cpu.cores 2
cpu.vendor GenuineIntel
cpu.family 6
cpu.model 94
cpu.stepping 3
cpu.l2cacheKB 256
cpu.l3cacheKB 3072
cpu.speedMHz 3700
cpu.extensions [hasMMX, hasSSE, hasSSE2, hasSSE3, hasSSSE3, hasSSE4_1, hasSSE4_2, hasAVX, hasAVX2, hasAES]
os.name Linux
os.version 4.19.8-arch1-1-ARCH
os.locale de-DE
hdd.profile.model null
hdd.profile.revision null
hdd.binary.model null
hdd.binary.revision null
hdd.system.model null
hdd.system.revision null
gfx.D2DEnabled null
gfx.DWriteEnabled null
gfx.ContentBackend Skia
gfx.adapters.[0].description Intel Open Source Technology Center -- Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2)
gfx.adapters.[0].vendorID Intel Open Source Technology Center
gfx.adapters.[0].deviceID Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2)
gfx.adapters.[0].subsysID null
gfx.adapters.[0].RAM null
gfx.adapters.[0].driver null
gfx.adapters.[0].driverVersion 3.0 Mesa 18.2.6
gfx.adapters.[0].driverDate null
gfx.adapters.[0].GPUActive true
gfx.monitors []
gfx.features.compositor basic
gfx.features.gpuProcess.status unused
gfx.features.wrQualified.status blocked
gfx.features.webrender.status unavailable
appleModelId null

@zzottel
Copy link
Author

zzottel commented Dec 14, 2018

BTW, this did not happen with earlier versions of Riot Web. I think it started with 0.17.0, but I'm not sure.

@jryans
Copy link
Collaborator

jryans commented Dec 17, 2018

Do you observe the same behavior in other browsers, or only in Firefox?

@zzottel
Copy link
Author

zzottel commented Dec 20, 2018

I used it for one and a half days in Chromium (Linux) now and didn't see any problems. There are hangs, sometimes, too, like only spinners for about 10s or more, but I guess that's probably caused by Synapse. Chromium populates the not-yet-loaded items much faster than Firefox afterwards (while I don't see much of a speed difference otherwise), and it doesn't become unusable over time.

That's not a solution for me, unfortunately, as I'm not allowed to install other browsers at work.

@sandys
Copy link

sandys commented Dec 20, 2018

is this related to #7801 ?

@zzottel
Copy link
Author

zzottel commented Dec 20, 2018

More notes:

  • Tried with a new tab in FF today instead of opening an existing Riot tab. Same problem.
  • To be sure that no kind of blocking is involved in the problem (CORS error failing to connect to HS using Brave #7801), I completely deactivated uBlock Origin and restarted FF. I think I have some cookie blocking enabled there (though 3rd party cookies are allowed in general), but can't look now as it is deactivated. :-) I'll report if that makes a difference.

@jryans
Copy link
Collaborator

jryans commented Dec 20, 2018

Thanks for the continued updates! I would certainly like to work out what's causing the poor experience you're seeing.

Are you always running the stable version on riot.im/app?

@zzottel
Copy link
Author

zzottel commented Dec 20, 2018

I'm running a self-hosted stable version against my own Synapse.

I can't be 100% sure yet, but it seems that deactivating uBlock Origin did the trick (though separate cookie blocking isn't even possible there, I misremembered that). Riot Web worked much longer than normally, I think, until it broke on Matrix HQ and FF told me that this tab was slowing down the browser over and over again each time I told it to wait. This was reproducible every time I looked at Matrix HQ for a few minutes; then I fired up the dev tools to look what was going on, but since then it doesn't happen anymore. X-)

I have uBlock Origin activated again now, but not for the Riot tab. Let's see how it turns out.

@jryans
Copy link
Collaborator

jryans commented Dec 20, 2018

I can't be 100% sure yet, but it seems that deactivating uBlock Origin did the trick (though separate cookie blocking isn't even possible there, I misremembered that).

Aha, glad to hear there is a potential theory at least! 😁

it broke on Matrix HQ and FF told me that this tab was slowing down the browser over and over again each time I told it to wait

For this particular bit, you are definitely not alone. Several people mentioned seeing this in both Chrome and Firefox today, but now the room state seems to have changed and resolved the issue for now. Anyway, please do let us know if this variant returns as well.

@zzottel
Copy link
Author

zzottel commented Dec 21, 2018

Another insight: While investigating 502 errors I saw in the connections tool, I found in the Synapse README that an Apache proxy should have the nocanon option added to the ProxyPass keyword, which wasn't the case at my proxy. This eliminated the 502s, and it seems as if Riot Web now even works with uBlock Origin enabled—at least for a few hours, which is more than I often got before.

Could it be the combination of proxy errors and uBlock Origin that was the problem?

As I'm off for holidays now, I can't test it over the next two weeks to be really sure that helped. I'll get back to you in January.

Happy holidays to you all! 🎄

@lampholder lampholder added T-Defect A-Performance P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Jan 8, 2019
@zzottel
Copy link
Author

zzottel commented Jan 11, 2019

Unfortunately, the measures above didn't fix the problem.

But over the last few days, I analyzed it a bit more, and I can provide more details:

  • FF doesn't actually become slower and slower over time, that was just an impression created by Synapse being slow. (Or maybe this has become better in newer FF versions (currently 64.0.2 on Windows and Linux), but the point is, I don't see that anymore.)
  • Also, when it comes to the point that Riot shows that it is disconnected and some JS in FF is blocked, restarting FF is not strictly required. If I wait for a few minutes (I think it's about 3-5 minutes), everything suddenly works again. Riot is then as quick as it was before. But restarting FF helps, too, you don't have to wait then. :-)
  • The problem does not show up when the Riot tab is the currently active tab. In this case, it will work for at least 6 hours without problems. (Which is why I thought I found the problem above.) If the Riot tab is in the background, though, for at least half an hour or maybe an hour, I do other stuff with FF and then come back to the Riot tab, the problem shows up.
  • At first, when switching back to the Riot tab, it seems normal. But if I then try to switch to another room, e.g., it shows the room, but stops while loading avatars. After some time Riot says it has last the connection to the HS.
  • On Windows, the notebook fan starts blowing wildly, some JS is blocked. Examples: I can't switch to other tabs using the Tree Style Tab extension, it doesn't even display more tabs when scrolling down. In Zimbra, I can switch to another email, but it won't load, and after some time it shows that it can't connect to the server. Same in Riot itself, it is able to show that it has lost the connection to the server, so it seems to be running. But at least everything that tries to load something from the net using JS is blocked.

I hope that helps hunting down the problem. I'll change the issue title to better match the actual problem.

@zzottel zzottel changed the title Very slow over time on FF, even leads to disconnect JS networking blocked on FF after Riot has been in a background tab for a while Jan 11, 2019
@zzottel
Copy link
Author

zzottel commented Feb 25, 2019

This does not happen anymore.

I'm not sure, though, if it was fixed by Riot Web 1.0.1, Firefox 65.0.1, or by me starting to use workers in my Synapse installation.

My guess is that it's the latter—that it only happened because after switching to the Riot tab, my Synapse was busy sending presence updates to large numbers of other homeservers and thus sometimes didn't answer for minutes. (I think I saw blocked tabs a few days ago again, but it was only for a second or so.)

The question would then be why (and how) Riot Web blocks JS in other FF tabs if network requests aren't answered quickly.

@jryans
Copy link
Collaborator

jryans commented Feb 26, 2019

So far, I am not seeing anything here that Riot itself can change to improve the situation. It sounds like it is related more to how Firefox internally schedules work like network activity and JS execution among tabs. Does that sound correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Performance P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

4 participants