zachleat / speedlify

Benchmark the web performance and accessibility of sites over time.
https://www.speedlify.dev/
MIT License
919 stars 167 forks source link

How to fix this build timeout error? #44

Closed surjithctly closed 2 years ago

surjithctly commented 3 years ago

I couldn't build this for first time because this returns the following error every time. I tried few times re-running. Any other way?

7:49:56 PM: Logged an error with https://web3canvas.com/:  LighthouseError [LHError]: PROTOCOL_TIMEOUT
7:49:56 PM:     at Timeout._onTimeout (/opt/build/repo/node_modules/lighthouse/lighthouse-core/gather/driver.js:341:21)
7:49:56 PM:     at listOnTimeout (internal/timers.js:554:17)
7:49:56 PM:     at processTimers (internal/timers.js:497:7) {
7:49:56 PM:   code: 'PROTOCOL_TIMEOUT',
7:49:56 PM:   friendlyMessage: 'Waiting for DevTools protocol response has exceeded the allotted time. (Method: Runtime.evaluate)',
7:49:56 PM:   lhrRuntimeError: true,
7:49:56 PM:   protocolMethod: 'Runtime.evaluate'
7:49:56 PM: }
zachleat commented 3 years ago

I had the same error! As a temporary fix, I downgraded the performance-leaderboard package to downgrade the version of lighthouse and it works better. Check the live branch package.json

surjithctly commented 3 years ago

Yes, it works now.

Is it a lighthouse error? Shall I keep this issue open?

zachleat commented 3 years ago

Yeah I think it is. We'll have to retest after a new lighthouse release. Please do keep this open!

nhoizey commented 3 years ago

I have the same issue, but I use the same dependency version as the live branch here: "performance-leaderboard": "^3.3.0",

@zachleat did you suggest to use an even lower version?

nhoizey commented 2 years ago

Still having the issue, I added a comment to an issue in Lighthouse project: https://github.com/GoogleChrome/lighthouse/issues/6512#issuecomment-971866859

davidhund commented 2 years ago

I too ran into the PROTOCOL_TIMEOUT error. @patrickhulce mentioned the Chrome flag --disable-dev-shm-usage at https://github.com/GoogleChrome/lighthouse/issues/6512#issuecomment-924123935 and I noticed it is not used in the default performance-leaderboard Chrome options.

Adding it to the Speedlify options in your sites/*.js as such seems to fix the issue (for now?):

        // [...]
    options: {
                [ ... ]
        chromeFlags: ['--headless', '--disable-dev-shm-usage'] // <-- Add This!
    },

        [ ... ]
nhoizey commented 2 years ago

@davidhund it looks like it works! 🙏

Most tests were failing here before: https://perf.nicolas-hoizey.com/nicolas-hoizey.photo/

zachleat commented 2 years ago

Oooh, awesome! From reading the issue—it looks like this belongs strictly in speedlify, not in performance-leaderboard. Looks like it’s intended for containerized environments only? Does it hurt to have it added when running on a non-containerized env?

davidhund commented 2 years ago

Oooh, awesome! From reading the issue—it looks like this belongs strictly in speedlify, not in performance-leaderboard. Looks like it’s intended for containerized environments only? Does it hurt to have it added when running on a non-containerized env?

I'm not sure @zachleat — This flag does seem to be intended for Unix/Docker environments only (with smaller /dev/smh?). There's some discussion in Puppeteer at https://github.com/puppeteer/puppeteer/issues/1834 and https://bugs.chromium.org/p/chromium/issues/detail?id=736452#c64

I've seen someone mentioning --shm-size=1gb as an alternative workaround, but I'm not knowledgeable enough to really comment on it ;-)

zachleat commented 2 years ago

Well, I added chromeFlags: ['--headless', '--disable-dev-shm-usage'] to the default Speedlify options and it appears to be working great—thank you so much @davidhund