element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.04k stars 1.96k forks source link

UI freezes for multiple seconds #21127

Closed germain-gg closed 2 years ago

germain-gg commented 2 years ago

Steps to reproduce

Haven't managed to consistently reproduce the issue. Also experienced by @novocaine and @turt2live today

Outcome

What did you expect?

A smooth 60fps rendering

What happened instead?

UI is frozen for multiple seconds

Operating system

No response

Browser information

No response

URL for webapp

No response

Application version

No response

Homeserver

No response

Will you send logs?

No

andybalaam commented 2 years ago

I just saw my UI freeze and I had to refresh to get back to a usable system. Ubuntu 21.10 Firefox 64.0 https://develop.element.io It happened when I entered the Dendrite room.

andybalaam commented 2 years ago

This just happened to me again. I'll keep the tab around in case I can debug or something.

andybalaam commented 2 years ago

I opened a new tab on develop.element.io and it immediately froze too, which might be a helpful data point?

dbkr commented 2 years ago

Repro steps:

  1. join the dendrite room (https://matrix.to/#/#dendrite:matrix.org)
  2. switch to a different room
  3. clear cache & reload
  4. switch to the dendrite room
  5. freeze

and, hopefully irrelevant now we have a fix, but I nabbed a profile anyway:

Screenshot 2022-02-22 at 17 15 46
dbkr commented 2 years ago

I can still repro this with the new nightly build It looks like might be a few more places that need throttling, although the profile on nightly isn't letting me click through to the source so I can't easily see where:

Screenshot 2022-02-22 at 18 11 46
andybalaam commented 2 years ago

I got this again just now on develop.element.io. Trying to rageshake.

andybalaam commented 2 years ago

Managed to capture a profile of another freeze: freeze-opening-room.json.gz

andybalaam commented 2 years ago

Another profile - I think this one is better: profile-freeze-3mins.json.gz

My UI froze for 3 minutes, and the profiler was started before it happened.

andybalaam commented 2 years ago

image

andybalaam commented 2 years ago

image

andybalaam commented 2 years ago

image

HarHarLinks commented 2 years ago

I think I hit this on desktop. Submitted a rageshake with this issue as target. Happened when I entered #element-web:matrix.org

dbkr commented 2 years ago

Regressed by https://github.com/matrix-org/matrix-react-sdk/pull/7816 which turned on the event handler which was just sitting there doing nothing before because the listener was on the wrong object.

dbkr commented 2 years ago

...and reopening. It's better, but still pauses for somewhere between 6s and 2 mins due to updateHighestPlUser. I can do the same throttling to this but the onMember for permalinks still takes a bit of time which could be a 10 second pause. Feels like we need a better solution, eg. using the new batch event.