question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

max-wait-for-load not working

See original GitHub issue

I tried adding details in https://github.com/GoogleChrome/lighthouse/issues/11615 but dependabot marked and closed it as a duplicate. The max-wait-for-load flag doesn’t seem to be working unless I’m misunderstanding.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
patrickhulcecommented, Nov 1, 2020

That won’t catch any hanging in the audit process once Chrome is out of the picture (which is why we recommend and provide examples of the child process model), but it should solve this specific PROTOCOL_TIMEOUT issue 👍

Thanks for sharing it with others @adamhenson 😃

1reaction
adamhensoncommented, Nov 1, 2020

For anyone who comes across this, I’m creating my own timeout programmatically with the following code. If someone sees something wrong with this, please let me know. The only caveat is that it masks the true problem (if a PROTOCOL_TIMEOUT would have occurred - you won’t know). This is needed for me because I run a gigantic queue of Lighthouse audits and I can’t have a single Lighthouse process hang for 10 minutes.

The below code is a simplified version of what I’m doing and may not work exactly as is. Hope it helps others.

const TIMEOUT = 60000;
const TIMEOUT_ERROR_MESSAGE = 'TIMEOUT';
let chrome;

try {
  chrome = await chromeLauncher.launch({
    chromeFlags: options.chromeFlags,
    port: options.port
  });

  const result = await Promise.race([
    lighthouse(url, options, config),
    new Promise(resolve => {
      setTimeout(resolve, TIMEOUT, TIMEOUT_ERROR_MESSAGE);
    }),
  ]);

  if (result === TIMEOUT_ERROR_MESSAGE) {
    throw Error(TIMEOUT_ERROR_MESSAGE);
  }

  await chrome.kill();

  return result;
} catch (error) {
  // make sure we kill chrome
  if (chrome) {
    await chrome.kill();
  }

  throw error;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

max-wait-for-load not working · Issue #11615 - GitHub
Run LH on lighthouse https://www.clifbar.com/clif/ --chrome-flags="--headless" --max-wait-for-load=30000 Actual Times out with the error ...
Read more >
Lighthouse - Best of JS
This tool will aid in resolving discovered problems, providing a tool to be used to evaluate effectiveness of iterative changes while suggesting actionable ......
Read more >
Using Lighthouse in Chrome DevTools - GitHub Pages
[default: localhost] --max-wait-for-load The timeout (in milliseconds) to wait before the page is considered done loading and the run should continue.
Read more >
lighthouse - npm
--max-wait-for-load The timeout (in milliseconds) to wait before the page is ... daemon not running. starting it now on port 5037 *.
Read more >
Lighthouse: proto/lighthouse-result.proto | Fossies
51 PROTOCOL_TIMEOUT = 17; 52 // Used when the page is not responding after maxWaitForLoad. 53 PAGE_HUNG = 18; 54 // DNS failure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found