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

Browser tab crashes on some pages running bf-cache #16195

Open
3 tasks done
aarongoldenthal opened this issue Sep 23, 2024 · 3 comments
Open
3 tasks done

Browser tab crashes on some pages running bf-cache #16195

aarongoldenthal opened this issue Sep 23, 2024 · 3 comments

Comments

@aarongoldenthal
Copy link

aarongoldenthal commented Sep 23, 2024

FAQ

URL

https://aarongoldenthal.gitlab.io/-/aarongoldenthal/-/jobs/7889239617/artifacts/public/index.html

What happened?

When updating Lighthouse from 12.2.0 to 12.2.1, this page started crashing during the bf-cache test. This was run from a local server in GitLab CI (on the Linux container image here, but the given URL is the page that was requested, and running the same container locally against it produced the same results. The test is run twice, with and without the --preset=desktop, and the error only occurs with the desktop preset.

The specific command was:

lighthouse http://localhost:3000 --chrome-flags="--headless" --only-categories="accessibility,best-practices,performance,seo" --output="json,html" --output-path="lighthouse-desktop" --preset=desktop

What did you expect?

Test should run without browser tab crashing.

What have you tried?

Tested in same container image locally and got the same results. Tried multiple tests and this does occur with 12.2.1, but not 12.2.0, with the desktop preset. Tested with Chrome 128 (128.0.6613.137) and 129 (129.0.6668.58) with the same results.

Also tried running against the same page from Chrome devtools and the bf-cache test does successfully execute (it fails, but executes).

How were you running Lighthouse?

CLI

Lighthouse Version

12.2.1

Chrome Version

128 and 129

Node Version

20.17.0

OS

Debian Bookworm (container, from the node:20.17.0-bookworm-slim image)

Relevant log output

{
  "lighthouseVersion": "12.2.1",
  "requestedUrl": "https://aarongoldenthal.gitlab.io/-/aarongoldenthal/-/jobs/7889239617/artifacts/public/index.html",
  "mainDocumentUrl": "https://aarongoldenthal.gitlab.io/-/aarongoldenthal/-/jobs/7889239617/artifacts/public/index.html",
  "finalDisplayedUrl": "https://aarongoldenthal.gitlab.io/-/aarongoldenthal/-/jobs/7889239617/artifacts/public/index.html",
  "finalUrl": "https://aarongoldenthal.gitlab.io/-/aarongoldenthal/-/jobs/7889239617/artifacts/public/index.html",
  "fetchTime": "2024-09-23T00:44:44.390Z",
  "gatherMode": "navigation",
  "runtimeError": {
    "code": "TARGET_CRASHED",
    "message": "Browser tab has unexpectedly crashed."
  },
  "runWarnings": [],
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/129.0.0.0 Safari/537.36",
  "environment": {
    "networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
    "hostUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/129.0.0.0 Safari/537.36",
    "benchmarkIndex": 2239.5,
    "credits": {
      "axe-core": "4.10.0"
    }
  },
  "audits": {
    ...
    "bf-cache": {
      "id": "bf-cache",
      "title": "Page didn't prevent back/forward cache restoration",
      "description": "Many navigations are performed by going back to a previous page, or forwards again. The back/forward cache (bfcache) can speed up these return navigations. [Learn more about the bfcache](https://developer.chrome.com/docs/lighthouse/performance/bf-cache/)",
      "score": null,
      "scoreDisplayMode": "error",
      "errorMessage": "Required BFCacheFailures gatherer encountered an error: TARGET_CRASHED",
      "errorStack": "LighthouseError: TARGET_CRASHED\n    at ProtocolSession.<anonymous> (file:///lighthouse/node_modules/lighthouse/core/gather/session.js:61:11)\n    at ProtocolSession.emit (node:events:519:28)\n    at ProtocolSession._handleProtocolEvent (file:///lighthouse/node_modules/lighthouse/core/gather/session.js:76:10)\n    at file:///lighthouse/node_modules/puppeteer-core/lib/esm/third_party/mitt/mitt.js:38:7\n    at Array.map (<anonymous>)\n    at Object.emit (file:///lighthouse/node_modules/puppeteer-core/lib/esm/third_party/mitt/mitt.js:37:39)\n    at CdpCDPSession.emit (file:///lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js:77:23)\n    at CdpCDPSession._onMessage (file:///lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js:79:18)\n    at Connection.onMessage (file:///lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Connection.js:139:25)\n    at WebSocket.<anonymous> (file:///lighthouse/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js:38:32)",
      "guidanceLevel": 4
    }
  },
  ...
}
@adamraine
Copy link
Member

See #14957 (comment)

The bfcache audit is not supported when using old headless mode, although I've never seen this cause a crash before. Perhaps we should just disable the bfcache gatherer completely when we detect the old headless mode.

@aarongoldenthal
Copy link
Author

See #14957 (comment)

The bfcache audit is not supported when using old headless mode, although I've never seen this cause a crash before. Perhaps we should just disable the bfcache gatherer completely when we detect the old headless mode.

Thanks @adamraine

My understanding was that new headless was the default with --headless, and that seems consistent with this post. When I tried with --chrome-flags="--headless=new" I get the same results.

If I use --chrome-flags="--headless=old", the run passes and the bf-cache test has a message that it's unsupported with old headless.

With skipAudits: ['bf-cache'], it's still crashing, which I see here, but with no stack trace. Looking back it's also in the original crash, I just got focused on the test with the stack trace.

...
  "icuMessagePaths": {
    "core/lib/lh-error.js | targetCrashed": [{ values": { errorCode": "TARGET_CRASHED" }, path": "runtimeError.message" }],
  },
...

The complete log is attached: lighthouse-desktop.report.json

@adamraine
Copy link
Member

Yeah I think you are right, although I haven't reproduced the crash yet outside of a docker container. Need to dig into the log you sent.

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

4 participants