GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.27k stars 9.35k forks source link

Timed out waiting for page load. Checking if page is hung... +45s #14119

Closed DavidFekiac closed 2 years ago

DavidFekiac commented 2 years ago

FAQ

URL

https://www.centrum.sk

What happened?

Hi everyone,

when i try to run lighthouse to test our company site it takes a really long time and produces low score. The score may be deserved but the time to take the test bothered me so i installed a lighthouse npm package and ran the test through that. While the results were mostly the same I noticed this in the logs:

LH:status Loading page & waiting for onload +0ms LH:status Navigating to https://www.centrum.sk/ +0ms LH:waitFor:warn Timed out waiting for page load. Checking if page is hung... +45s LH:status Gathering in-page: ServiceWorker +6ms LH:status Gathering devtoolsLog & network records +1ms

Seems that the loading of the page has sort of a timeout but the tests continue afterwards as if nothing has happened.

What did you expect?

No timeout when running the test.

What have you tried?

I did look at current and past issues hoping that someone ran into the same problem, but I didnt find anything that would explain why this is happening or how to fix it.

How were you running Lighthouse?

node, PageSpeed Insights, Chrome DevTools, web.dev

Lighthouse Version

9.6.2

Chrome Version

Version 100.0.4896.127 (Official Build) (arm64)

Node Version

v16.13.1

OS

Windows and Mac

Relevant log output

LH:ChromeLauncher Waiting for browser. +0ms
  LH:ChromeLauncher Waiting for browser... +1ms
  LH:ChromeLauncher Waiting for browser..... +515ms
  LH:ChromeLauncher Waiting for browser.....✓ +11ms
  LH:config:warn IFrameElements gatherer requested, however no audit requires it. +168ms
  LH:config:warn Inputs gatherer requested, however no audit requires it. +0ms
  LH:status Connecting to browser +26ms
  LH:status Resetting state with about:blank +253ms
  LH:status Navigating to about:blank +0ms
  LH:status Benchmarking machine +11ms
  LH:status Initializing… +1s
  LH:status Preparing target for navigation mode +2ms
  LH:status Running defaultPass pass CSSUsage, JsUsage, ViewportDimensions, ConsoleMessages, AnchorElements, ImageElements, LinkElements, MetaElements, ScriptElements, IFrameElements, Inputs, MainDocumentContent, GlobalListeners, Doctype, DOMStats, OptimizedImages, PasswordInputsWithPreventedPaste, ResponseCompression, TagsBlockingFirstPaint, FontSize, EmbeddedContent, RobotsTxt, TapTargets, Accessibility, TraceElements, InspectorIssues, SourceMaps, FullPageScreenshot +7ms
  LH:status Resetting state with about:blank +0ms
  LH:status Navigating to about:blank +0ms
  LH:status Preparing target for navigation +6ms
  LH:status Cleaning origin data +76ms
  LH:status Cleaning browser cache +2ms
  LH:status Preparing network conditions +42ms
  LH:status Beginning devtoolsLog and trace +13ms
  LH:status Loading page & waiting for onload +33ms
  LH:status Navigating to https://www.centrum.sk/ +0ms
  LH:waitFor:warn Timed out waiting for page load. Checking if page is hung... +45s
  LH:status Gathering in-page: CSSUsage +8ms
  LH:status Gathering in-page: JsUsage +0ms
  LH:status Gathering in-page: ViewportDimensions +0ms
  LH:status Gathering in-page: ConsoleMessages +0ms
  LH:status Gathering in-page: AnchorElements +0ms
  LH:status Gathering in-page: ImageElements +0ms
  LH:status Gathering in-page: LinkElements +0ms
  LH:status Gathering in-page: MetaElements +0ms
  LH:status Gathering in-page: ScriptElements +0ms
  LH:status Gathering in-page: IFrameElements +0ms
  LH:status Gathering in-page: Inputs +0ms
  LH:status Gathering in-page: MainDocumentContent +0ms
  LH:status Gathering in-page: GlobalListeners +0ms
  LH:status Gathering in-page: Doctype +0ms
  LH:status Gathering in-page: DOMStats +0ms
  LH:status Gathering in-page: OptimizedImages +1ms
  LH:status Gathering in-page: PasswordInputsWithPreventedPaste +0ms
  LH:status Gathering in-page: ResponseCompression +0ms
  LH:status Gathering in-page: TagsBlockingFirstPaint +0ms
  LH:status Gathering in-page: FontSize +0ms
  LH:status Gathering in-page: EmbeddedContent +0ms
  LH:status Gathering in-page: RobotsTxt +0ms
  LH:status Gathering in-page: TapTargets +0ms
  LH:status Gathering in-page: Accessibility +0ms
  LH:status Gathering in-page: TraceElements +0ms
  LH:status Gathering in-page: InspectorIssues +0ms
  LH:status Gathering in-page: SourceMaps +0ms
  LH:status Gathering in-page: FullPageScreenshot +0ms
  LH:status Gathering trace +0ms
  LH:status Gathering devtoolsLog & network records +856ms
  LH:status Gathering: CSSUsage +8ms
  LH:status Gathering: JsUsage +126ms
  LH:status Gathering: ViewportDimensions +38ms
  LH:status Gathering: ConsoleMessages +1ms
  LH:status Gathering: AnchorElements +1ms
  LH:status Gathering: ImageElements +96ms
  LH:status Gathering: LinkElements +1s
  LH:status Gathering: MetaElements +5ms
  LH:status Gathering: ScriptElements +3ms
  LH:status Gathering: IFrameElements +55ms
  LH:status Gathering: Inputs +3ms
  LH:status Gathering: MainDocumentContent +17ms
  LH:status Gathering: GlobalListeners +9ms
  LH:status Gathering: Doctype +2ms
  LH:status Gathering: DOMStats +1ms
  LH:status Gathering: OptimizedImages +4ms
  LH:status Gathering: PasswordInputsWithPreventedPaste +233ms
  LH:status Gathering: ResponseCompression +1ms
  LH:status Gathering: TagsBlockingFirstPaint +5ms
  LH:status Gathering: FontSize +2ms
  LH:status Gathering: EmbeddedContent +68ms
  LH:status Gathering: RobotsTxt +2ms
  LH:status Gathering: TapTargets +56ms
  LH:status Gathering: Accessibility +57ms
  LH:status Gathering: TraceElements +585ms
  LH:status Gathering: InspectorIssues +205ms
  LH:status Gathering: SourceMaps +2ms
  LH:status Gathering: FullPageScreenshot +217ms
  LH:status Populate base artifacts +5s
  LH:status Get webapp manifest +0ms
  LH:status Get webapp installability errors +1ms
  LH:status Collect stacks +1ms
  LH:status Running offlinePass pass ServiceWorker +14ms
  LH:status Resetting state with about:blank +0ms
  LH:status Navigating to about:blank +0ms
  LH:status Preparing target for navigation +23ms
  LH:status Preparing network conditions +0ms
  LH:status Beginning devtoolsLog and trace +3ms
  LH:status Loading page & waiting for onload +0ms
  LH:status Navigating to https://www.centrum.sk/ +0ms
  LH:waitFor:warn Timed out waiting for page load. Checking if page is hung... +45s
  LH:status Gathering in-page: ServiceWorker +6ms
  LH:status Gathering devtoolsLog & network records +1ms
  LH:status Gathering: ServiceWorker +12ms
  LH:status Disconnecting from browser... +1ms
  LH:status Cleaning origin data +0ms
  LH:status Analyzing and running audits... +102ms
  LH:status Auditing: Uses HTTPS +4ms
  LH:status Auditing: Registers a service worker that controls page and `start_url` +5ms
  LH:status Auditing: Has a `<meta name="viewport">` tag with `width` or `initial-scale` +3ms
  LH:status Auditing: First Contentful Paint +3ms
  LH:status Auditing: Largest Contentful Paint +38ms
  LH:status Auditing: First Meaningful Paint +18ms
  LH:status Auditing: Speed Index +4ms
  LH:status Auditing: Screenshot Thumbnails +292ms
  LH:status Auditing: Final Screenshot +172ms
  LH:status Auditing: Total Blocking Time +5ms
  LH:status Auditing: Max Potential First Input Delay +17ms
  LH:status Auditing: Cumulative Layout Shift +9ms
  LH:status Auditing: No browser errors logged to the console +1ms
  LH:status Auditing: Initial server response time was short +47ms
  LH:status Auditing: Time to Interactive +2ms
  LH:status Auditing: User Timing marks and measures +1ms
  LH:status Auditing: Avoid chaining critical requests +6ms
  LH:status Auditing: Avoid multiple page redirects +2ms
  LH:status Auditing: Web app manifest and service worker meet the installability requirements +11ms
  LH:status Auditing: Provides a valid `apple-touch-icon` +2ms
  LH:status Auditing: Configured for a custom splash screen +1ms
  LH:status Auditing: Sets a theme color for the address bar. +1ms
  LH:status Auditing: Manifest has a maskable icon +1ms
  LH:status Auditing: Content is sized correctly for the viewport +1ms
  LH:status Auditing: Displays images with correct aspect ratio +1ms
  LH:status Auditing: Serves images with appropriate resolution +2ms
  LH:status Auditing: Fonts with `font-display: optional` are preloaded +2ms
  LH:status Auditing: Avoids deprecated APIs +1ms
  LH:status Auditing: Minimizes main-thread work +0ms
  LH:status Auditing: JavaScript execution time +53ms
  LH:status Auditing: Preload key requests +8ms
  LH:status Auditing: Preconnect to required origins +0ms
  LH:status Auditing: All text remains visible during webfont loads +2ms
  LH:status Auditing: Diagnostics +3ms
  LH:status Auditing: Network Requests +1ms
  LH:status Auditing: Network Round Trip Times +1ms
  LH:status Auditing: Server Backend Latencies +1ms
  LH:status Auditing: Tasks +1ms
  LH:status Auditing: Metrics +0ms
  LH:status Auditing: Performance budget +1ms
  LH:status Auditing: Timing budget +2ms
  LH:status Auditing: Keep request counts low and transfer sizes small +0ms
  LH:status Auditing: Minimize third-party usage +2ms
  LH:status Auditing: Lazy load third-party resources with facades +6ms
  LH:status Auditing: Largest Contentful Paint element +14ms
  LH:status Auditing: Largest Contentful Paint image was not lazily loaded +1ms
  LH:status Auditing: Avoid large layout shifts +1ms
  LH:status Auditing: Avoid long main-thread tasks +1ms
  LH:status Auditing: Avoids `unload` event listeners +6ms
  LH:status Auditing: Avoid non-composited animations +1ms
  LH:status Auditing: Image elements have explicit `width` and `height` +6ms
  LH:status Auditing: Page has valid source maps +2ms
  LH:status Auditing: Preload Largest Contentful Paint image +3ms
  LH:status Auditing: Ensure CSP is effective against XSS attacks +4ms
  LH:status Auditing: Full-page screenshot +1ms
  LH:status Auditing: Script Treemap Data +0ms
  LH:status Auditing: Site works cross-browser +58ms
  LH:status Auditing: Page transitions don't feel like they block on the network +1ms
  LH:status Auditing: Each page has a URL +1ms
  LH:status Auditing: `[accesskey]` values are unique +1ms
  LH:status Auditing: `[aria-*]` attributes match their roles +1ms
  LH:status Auditing: `button`, `link`, and `menuitem` elements have accessible names +2ms
  LH:status Auditing: `[aria-hidden="true"]` is not present on the document `<body>` +1ms
  LH:status Auditing: `[aria-hidden="true"]` elements do not contain focusable descendents +4ms
  LH:status Auditing: ARIA input fields have accessible names +3ms
  LH:status Auditing: ARIA `meter` elements have accessible names +1ms
  LH:status Auditing: ARIA `progressbar` elements have accessible names +2ms
  LH:status Auditing: `[role]`s have all required `[aria-*]` attributes +1ms
  LH:status Auditing: Elements with an ARIA `[role]` that require children to contain a specific `[role]` have all required children. +3ms
  LH:status Auditing: `[role]`s are contained by their required parent element +1ms
  LH:status Auditing: `[role]` values are valid +2ms
  LH:status Auditing: ARIA toggle fields have accessible names +3ms
  LH:status Auditing: ARIA `tooltip` elements have accessible names +2ms
  LH:status Auditing: ARIA `treeitem` elements have accessible names +1ms
  LH:status Auditing: `[aria-*]` attributes have valid values +2ms
  LH:status Auditing: `[aria-*]` attributes are valid and not misspelled +2ms
  LH:status Auditing: Buttons have an accessible name +3ms
  LH:status Auditing: The page contains a heading, skip link, or landmark region +3ms
  LH:status Auditing: Background and foreground colors have a sufficient contrast ratio +2ms
  LH:status Auditing: `<dl>`'s contain only properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements. +3ms
  LH:status Auditing: Definition list items are wrapped in `<dl>` elements +1ms
  LH:status Auditing: Document has a `<title>` element +2ms
  LH:status Auditing: `[id]` attributes on active, focusable elements are unique +2ms
  LH:status Auditing: ARIA IDs are unique +3ms
  LH:status Auditing: No form fields have multiple labels +2ms
  LH:status Auditing: `<frame>` or `<iframe>` elements have a title +4ms
  LH:status Auditing: Heading elements appear in a sequentially-descending order +2ms
  LH:status Auditing: `<html>` element has a `[lang]` attribute +3ms
  LH:status Auditing: `<html>` element has a valid value for its `[lang]` attribute +4ms
  LH:status Auditing: Image elements have `[alt]` attributes +3ms
  LH:status Auditing: `<input type="image">` elements have `[alt]` text +2ms
  LH:status Auditing: Form elements have associated labels +2ms
  LH:status Auditing: Links have a discernible name +2ms
  LH:status Auditing: Lists contain only `<li>` elements and script supporting elements (`<script>` and `<template>`). +2ms
  LH:status Auditing: List items (`<li>`) are contained within `<ul>` or `<ol>` parent elements +4ms
  LH:status Auditing: The document does not use `<meta http-equiv="refresh">` +2ms
  LH:status Auditing: `[user-scalable="no"]` is not used in the `<meta name="viewport">` element and the `[maximum-scale]` attribute is not less than 5. +2ms
  LH:status Auditing: `<object>` elements have alternate text +4ms
  LH:status Auditing: No element has a `[tabindex]` value greater than 0 +1ms
  LH:status Auditing: Cells in a `<table>` element that use the `[headers]` attribute refer to table cells within the same table. +3ms
  LH:status Auditing: `<th>` elements and elements with `[role="columnheader"/"rowheader"]` have data cells they describe. +3ms
  LH:status Auditing: `[lang]` attributes have a valid value +2ms
  LH:status Auditing: `<video>` elements contain a `<track>` element with `[kind="captions"]` +3ms
  LH:status Auditing: Custom controls have associated labels +2ms
  LH:status Auditing: Custom controls have ARIA roles +0ms
  LH:status Auditing: User focus is not accidentally trapped in a region +0ms
  LH:status Auditing: Interactive controls are keyboard focusable +0ms
  LH:status Auditing: Interactive elements indicate their purpose and state +0ms
  LH:status Auditing: The page has a logical tab order +0ms
  LH:status Auditing: The user's focus is directed to new content added to the page +0ms
  LH:status Auditing: Offscreen content is hidden from assistive technology +0ms
  LH:status Auditing: HTML5 landmark elements are used to improve navigation +0ms
  LH:status Auditing: Visual order on the page follows DOM order +0ms
  LH:status Auditing: Uses efficient cache policy on static assets +0ms
  LH:status Auditing: Avoids enormous network payloads +3ms
  LH:status Auditing: Defer offscreen images +1ms
  LH:status Auditing: Eliminate render-blocking resources +8ms
  LH:status Auditing: Minify CSS +1ms
  LH:status Auditing: Minify JavaScript +19ms
  LH:status Auditing: Reduce unused CSS +108ms
  LH:status Auditing: Reduce unused JavaScript +5ms
  LH:status Auditing: Serve images in next-gen formats +6ms
  LH:status Auditing: Efficiently encode images +12ms
  LH:status Auditing: Enable text compression +11ms
  LH:status Auditing: Properly size images +8ms
  LH:status Auditing: Use video formats for animated content +6ms
  LH:status Auditing: Remove duplicate modules in JavaScript bundles +6ms
  LH:status Auditing: Avoid serving legacy JavaScript to modern browsers +6ms
  LH:status Auditing: Page has the HTML doctype +73ms
  LH:status Auditing: Properly defines charset +1ms
  LH:status Auditing: Avoids an excessive DOM size +1ms
  LH:status Auditing: Avoids requesting the geolocation permission on page load +1ms
  LH:status Auditing: No issues in the `Issues` panel in Chrome Devtools +1ms
  LH:status Auditing: Avoids `document.write()` +1ms
  LH:status Auditing: Avoids front-end JavaScript libraries with known security vulnerabilities +1ms
  LH:status Auditing: Detected JavaScript libraries +3ms
  LH:status Auditing: Avoids requesting the notification permission on page load +0ms
  LH:status Auditing: Allows users to paste into password fields +1ms
  LH:status Auditing: Use HTTP/2 +1ms
  LH:status Auditing: Uses passive listeners to improve scrolling performance +5ms
  LH:status Auditing: Document has a meta description +1ms
  LH:status Auditing: Page has successful HTTP status code +1ms
  LH:status Auditing: Document uses legible font sizes +1ms
  LH:status Auditing: Links have descriptive text +1ms
  LH:status Auditing: Links are crawlable +2ms
  LH:status Auditing: Page isn’t blocked from indexing +2ms
  LH:status Auditing: robots.txt is valid +1ms
  LH:status Auditing: Tap targets are sized appropriately +1ms
  LH:status Auditing: Document has a valid `hreflang` +4ms
  LH:status Auditing: Document avoids plugins +1ms
  LH:status Auditing: Document has a valid `rel=canonical` +0ms
  LH:status Auditing: Structured data is valid +1ms
  LH:status Generating results... +0ms
  LH:Printer html output written to /Users/davidfekiac/www.centrum.sk_2022-06-13_08-37-33.report.html +37ms
  LH:CLI Protip: Run lighthouse with `--view` to immediately open the HTML report in your browser +0ms
  LH:ChromeLauncher Killing Chrome instance 48958 +0ms
adamraine commented 2 years ago

This is working as intended. The page loads too slowly to finish within our time limit. Do you see the following warning at the top of your Lighthouse report?

Screen Shot 2022-06-15 at 10 32 23 AM

DavidFekiac commented 2 years ago

Yes I ve seen it. However i dont think that it takes 45 seconds for page to load even under throttled conditions. I also changed the limit using --max-wait-for-load flag and set it to 5 minutes even. The navigation still timed out. We have an autoplay video for desktop version so i could understand that the network activity would confuse the tests, but mobile version is free of this and yet it still does not load within the time limit.

adamraine commented 2 years ago

Lighthouse waits for network quiet before finishing. This means the page must have 0 pending critical requests and no more than 2 pending requests. Critical requests are any request with Hight or VeryHigh priority.

https://www.google-analytics.com/collect is a critical request that doesn't finish within the time limit, so Lighthouse times out.

yogeshgadge commented 2 years ago

This is happening even without the "There were issues..."

Env macOS 12.5.1 node 16 lighthouse 9.6.7

lighthouse https://google.com --only-categories=performance,pwa --view --preset=desktop

results into

  LH:status Navigating to https://google.com/ +0ms
  LH:waitFor:warn Timed out waiting for page load. Checking if page is hung... +45s
  LH:waitFor:warn Page appears to be hung, killing JavaScript... +1s
Unhandled Rejection. Reason: LHError: PROTOCOL_TIMEOUT
  LH:ChromeLauncher Killing Chrome instance 12028 +18s

Report is never produced.

I see a Finders window and some PWA application added (which is my jira). I see that it installed the same application multiple times.

joelhsmith commented 10 months ago

I had a lot of sites failing (only in Docker hosted in OKD). They had images near and above 1MB. I got my script running by using the flags for blocking images. --blocked-url-patterns='*.png' --blocked-url-patterns='*.jpg' It makes some of the tests less accurate anymore, but it ran. It is worth trying to see if large images were causing the timeout.