element-hq / element-web

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

Export chat function freezes Element web #21403

Open viccuad opened 2 years ago

viccuad commented 2 years ago

Steps to reproduce

On both Firefox and Chromium. On a private, e2e encrypted room with 89000 events, try the "export chat function", with "From the beginning", size 8 MBs, include attachments no.

Everything goes fine until creating the html. It also never uses my full system memory, it only consumes 85%, at around 12 Gbs.

Then, the browser screen goes white on Firefox. Or on Chrome, I get a "something wrong has happened".

Excerpt logs from /rageshake:

I Creating HTML...
2022-03-12T14:52:15.556Z W Possible EventEmitter memory leak detected. 101 Thread.new listeners added. Use emitter.setMaxListeners() to increase limit
d@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:8597
s.prototype.addListener@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:11181
componentDidMount@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:549189
hs@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4153443
Tc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4170501
t.unstable_runWithPriority@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4195787
Vi@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4112378
Cc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4167048
hc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4163157
sc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4160280
Kc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4176600
Zc/<@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4178022
mc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4163310
Zc@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4178007
t.render@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:4185455
getEventTileMarkup@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6706538

(...)

Then around 50 of these:

2022-03-12T14:56:50.912Z E this.props.callEventGrouper is undefined
Bi@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6858498
a@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6720735
xe@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6721931
Ce</t.render@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6724507
Ce</t.read@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6724079
t.renderToStaticMarkup@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6729075
getEventTileMarkup@https://app.element.io/bundles/069fd4d72f624a5a90be/vendors~init.js:2:6706601

(...)

and on Firefox console I see:

 Uncaught out of memory setImmediate.js:65:37
    m setImmediate.js:65
    s setImmediate.js:144

Outcome

What did you expect?

Export chart function working.

What happened instead?

Element froze with a white background.

Operating system

Debian 11 Bullseye

Browser information

Firefox 91.6.1esr (64-bit) and Chromium Version 99.0.4844.51

URL for webapp

app.element.io

Application version

Element version: 1.10.6 Olm version: 3.2.8

Homeserver

matrix.org

Will you send logs?

No

turt2live commented 2 years ago

The CPU during export appears to consume an entire core and make 2 others busy, so it's definitely doing something wrong.

The profile isn't super revealing though: image

0fps render blocks and lots of time in tasks (not much more detail than that).

It appears to be specifically related to HTML exports.