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

High memory consumption from trace engine #16111

Open
3 tasks done
mattzeunert opened this issue Jul 11, 2024 · 2 comments
Open
3 tasks done

High memory consumption from trace engine #16111

mattzeunert opened this issue Jul 11, 2024 · 2 comments
Assignees

Comments

@mattzeunert
Copy link
Contributor

FAQ

URL

No shareable repro

What happened?

Node ran out of memory when running Lighthouse.

The memory profiler shows that invalidationsForEvent uses 328 MB.

Screenshot 2024-07-11 at 22 44 16

The invalidationsForEvent map has around 900 entries, but some of them have 10,000 or so SyntheticInvalidation events.

Screenshot 2024-07-11 at 22 43 58

What did you expect?

Lighthouse should run without crashing the Node process.

What have you tried?

No response

How were you running Lighthouse?

node

Lighthouse Version

12.1.0

Chrome Version

No response

Node Version

No response

OS

No response

Relevant log output

No response

@adamraine
Copy link
Member

I think your assessment is correct. Invalidation events are extremely noisy and have led to problems in the past like #15869.

The invalidationsForEvent object is in a part of the trace engine Lighthouse doesn't use so we should consider turning it off somehow if we can't optimize the memory usage.

@jackfranklin
Copy link

Hey @mattzeunert thanks for the report. Is it possible for you to share the website you were using that caused this high memory? Just to aid our debugging. I absolutely understand if it's private and you are unable to though. Thanks!

copybara-service bot pushed a commit to ChromeDevTools/devtools-frontend that referenced this issue Jul 12, 2024
I was investigating this bug in LH
[GoogleChrome/lighthouse#16111] where the
trace engine OOMs, and the reporter notes that the InvalidationsHandler
map is 328MB in size.

During my initial investigation I realised we were creating synthetic
invalidations for no real purpose; all the information exists in the
events as is, and instead we can just create a type to group them and
everything gets much more simple.

I don't expect this to resolve the problem in that bug report, but it is
firstly cleaner to not create synthetic events if we don't need to, and
it does also mean we are now not going to allocate a new object per
every invalidation we want to store, so I expect this to be a positive
change.

Bug: 352680159
Change-Id: I4817774ce692c0dd73eb2156389148d7b756208c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5702081
Auto-Submit: Jack Franklin <[email protected]>
Commit-Queue: Andres Olivares <[email protected]>
Reviewed-by: Andres Olivares <[email protected]>
@adamraine adamraine added P1.5 and removed P1 labels Aug 7, 2024
copybara-service bot pushed a commit to ChromeDevTools/devtools-frontend that referenced this issue Aug 8, 2024
We have seen instances where traces with a large amount of invalidations
can cause the trace engine to take a long time processing and hold onto
a lot of memory - even causing LH to OOM in Node (GoogleChrome/lighthouse#16111)

In these instances we've seen traces where one Layout event (as an
example) can be linked to thousands of invalidations. Once you get to
this point we aren't helping the user to debug by showing them a list of
every single invalidation. Therefore, to fix the performance of this
case, and to make the UI not a huge list, we now cap the number of
invalidations we will track. We also count the total, and in the UI we
now show this total.

By making this a configurable value, we can also allow a user to disable
Invalidations by setting it to 0. In this case we shortcut the handler
and will not process any events.

Bug: 352680159
Change-Id: I63c8dc41577e4a350788885a7bc23967ace0c10c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5766691
Commit-Queue: Jack Franklin <[email protected]>
Auto-Submit: Jack Franklin <[email protected]>
Reviewed-by: Adam Raine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants