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

Unexpectedly low main thread time #14264

Open
2 tasks done
mattzeunert opened this issue Aug 6, 2022 · 2 comments
Open
2 tasks done

Unexpectedly low main thread time #14264

mattzeunert opened this issue Aug 6, 2022 · 2 comments

Comments

@mattzeunert
Copy link
Contributor

mattzeunert commented Aug 6, 2022

FAQ

URL

https://twitter.com/migueldeicaza

What happened?

Run node ./cli/index.js --view https://twitter.com/migueldeicaza on master

The report says TBT and main thread activity are basically zero.
Screenshot 2022-08-06 at 14 07 06
Screenshot 2022-08-06 at 14 07 22

What did you expect?

The devtools trace artifact suggests quite a bit of main frame CPU activity.

Screenshot 2022-08-06 at 14 08 20

What have you tried?

In trace-processor.js Chrome correctly identifies the main thread id, 259 in this case.

I don't really understand how threads work in Chrome. I tried testing another page and having multiple process ids per thread seems normal.

In my case these are the process IDs:

> new Set(trace.traceEvents.filter(e => e.tid === 259).map(e => e.pid))
Set(4) {40151, 40181, 40169, 40199}

The process Lighthouse filters by seems to come from the first main frame thread_name event. But there seem to be two of those:

Screenshot 2022-08-06 at 14 18 12

This is one of the larger CPU tasks and it matches the second CrRendererMain process.

{"args":{},"cat":"disabled-by-default-devtools.timeline","dur":248954,"name":"RunTask","ph":"X","pid":40199,"tdur":246608,"tid":259,"ts":191377433302,"tts":210151},

How were you running Lighthouse?

CLI

Lighthouse Version

9.5.0 (though I don't think this issue is new)

Chrome Version

Chromium 106.0.0.0

Node Version

No response

OS

No response

Relevant log output

No response

@brendankenny
Copy link
Member

brendankenny commented Aug 8, 2022

I tried testing another page and having multiple process ids per thread seems normal.

Doesn't address the root issue, but for this, you need the (pid, tid) tuple to identify a thread. It's common for thread ids to be the same for different threads in different processes (edit: at least for Chrome threads. I don't know enough about thread IDs to make that claim generally :).

Can you share a trace by any chance?

@paulirish
Copy link
Member

Brendan and I looked into it and found some issues. In short, our frameEvents is a small subset of all events happening on that frame... and more important to this issue.. our processEvents can pick the incorrect process if there was a cross-origin redirect during navigation. This latter item seems like a regression somehow at some point. We'll dig into it.

Thanks @mattzeunert mucho for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment