Skip to content

Adds a small delay in between multiple runs

Choose a tag to compare

@adamhenson adamhenson released this 28 Jan 22:41
· 8 commits to master since this release

When multiple Lighthouse audits run via multiple URLs defined in the urls option, some faced an issue in which Lighthouse was not launching Chrome as described in #109.

It seems as though when upgrading our Node.js runner to version 16 the linked issue above started occurring. There seems to be 2 issues at play.

  1. Chrome Launcher intermittently fails to launch and does not throw an error or surface the problem in any way when Lighthouse runs consecutively in GitHub runners, which causes Lighthouse to mysteriously fail as it is unable to connect. It's unclear why this started happening on Node.js@16. lighthouse-persist is the package used that orchestrates Lighthouse and I attempted to detect chrome.pid and add retry logic, but unfortunately there is another issue with Chrome Launcher in which chrome.pid is undefined.
  2. In GitHub's Node 14 runner, when Chrome Launcher failed as described above, the try / catch / retry logic catches the error and succeeds on the first retry as seen here, but in GitHub's Node 16 runner the retry as described above seems to fail and the error bubbles all the way up on the first try and the retry logic isn't triggered as seen here. This is quite unusual, as we use a try / catch block which should catch any errors.

The above are caused by a combination of dependencies that seem to have unclear issues and even unclear sources (GitHub Runners? Chrome Launcher? Lighthouse?). And since these issues are out of our control, the best way I can offer to workaround them, is by adding a 1 second delay in between consecutive Lighthouse audits. My theory is that Chrome Launcher isn't correctly signaling when it is in fact launched and when it has been killed and therefore by giving it some time, we cushion the real problem.