Chrome crashes during run
I'm attempting to investigate CLS values in Lighthouse v6 Beta CLI, and the runner will fairly consistently hang and/or crash ~90% of the time on Etsy.com.
Provide the steps to reproduce
- Run LH on https://www.etsy.com --only-categories=performance
What is the current behavior?
I'm seeing two variations of similar behavior that seem to be related to the same underlying issue:
- The runner will open a new Chrome instance, the audit runs, the runner starts the process to detach from the browser window, but the window stays open and the runner hangs after the following lines are output:
method => browser:verbose Audits.getEncodedResponse {"requestId":"9493.4","encoding":"jpeg","quality":0.92,"sizeOnly":true} +0ms
method <= browser OK:verbose Audits.getEncodedResponse {"originalSize":233050,"encodedSize":248806} +25ms
method => browser:verbose Audits.getEncodedResponse {"requestId":"9493.4","encoding":"webp","quality":0.85,"sizeOnly":true} +1ms
<= event:verbose Target.detachedFromTarget {"sessionId":"18E03AAD97E889344ECF19B721CC17CC","targetId":"2CADCD0FEF2F0AA2AD41781C524ED691"} +87ms
<= event:verbose Target.detachedFromTarget {"sessionId":"0A4CF7568E21F504C30CE089DD3B9B31","targetId":"745B52982ABD67AAF5889ECC014BA8BD"} +0ms
<= event:verbose Inspector.detached {"reason":"target_closed"} +1ms
- Similar to above, but the browser window will close, and the runner will output the following error:
<= event:verbose Inspector.detached {"reason":"target_closed"} +1ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window +60s
status Disconnecting from browser... +1ms
method => browser:verbose Storage.clearDataForOrigin {"origin":"https://www.etsy.com","storageTypes":"appcache,file_systems,indexeddb,local_storage,shader_cache,websql,service_workers,cac +0ms
GatherRunner disconnect:error not opened +1ms
statusEnd:verbose Disconnecting from browser... +0ms
ChromeLauncher Killing Chrome instance 7763 +0ms
Runtime error encountered: not opened
Error: not opened
at WebSocket.send (/Users/ksylormiller/.config/yarn/global/node_modules/ws/lib/WebSocket.js:344:18)
at CriConnection.sendRawMessage (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:167:14)
at CriConnection.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/connection.js:66:10)
at Driver._innerSendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:383:29)
at /Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:345:35
at new Promise (<anonymous>)
ô®›m%ver.sendCommandToSession (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:336:12)
ô®›m#ver.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:363:17)
at Driver._evaluateInContext (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:470:33)
Ä
Here's a gist of the full verbose output https://gist.github.com/ksylor/882cd9d6f6f62a729c58e39fca15beeb
What is the expected behavior?
The runner completes and outputs the audit results consistently.
Environment Information
- Affected Channels: CLI
- Lighthouse version: 6.0.0-beta.0
- Chrome version: Google Chrome | 81.0.4044.138 (Official Build) (64-bit)
- Node.js version: v12.16.3
- Operating System: MacOS Mojave 10.14.6 (18G4032)
Related issues
Thanks for filing with detailed logs and description @ksylor !
I'm unfortunately unable to reproduce those errors. (7/7 working report, no fatal issues although there is an a11y bug https://github.com/dequelabs/axe-core/issues/2178)
The log output suggests that Chrome is crashing in the middle of the run when attempting to gather the image elements, and I would suspect that use of 6.0.0-beta.0 is unrelated. Do you see the same behavior if you try to use 5.6.0 or earlier?
I get the same error when running 5.6.0. Here's the last few lines of the stack trace
statusEnd:verbose Loading page & waiting for onload CSSUsage, ViewportDimensions, ImageElements, LinkElements, ScriptElements, DOMStats, OptimizedImages, ResponseCompression, TagsBlockingFirstPaint +4ms
status Disconnecting from browser... +0ms
method => browser:verbose Storage.clearDataForOrigin {"origin":"https://www.etsy.com","storageTypes":"appcache,file_systems,indexeddb,local_storage,shader_cache,websql,service_workers,cac +0ms
GatherRunner disconnect:error not opened +1ms
statusEnd:verbose Disconnecting from browser... +0ms
ChromeLauncher Killing Chrome instance 14819 +0ms
Runtime error encountered: not opened
Error: not opened
at WebSocket.send (/Users/ksylormiller/.config/yarn/global/node_modules/ws/lib/WebSocket.js:344:18)
at CriConnection.sendRawMessage (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:167:14)
at CriConnection.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/connection.js:65:10)
at Driver._innerSendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:442:29)
at /Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:416:35
at new Promise (<anonymous>)
at Driver.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:407:12)
at Driver._evaluateInContext (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:529:33)
at Driver.evaluateAsync (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:480:25)
at checkForQuiet (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:862:46)
Hm, so it's not even specific to collecting images then Chrome just crashes randomly at a random point during the load, so whatever is going wrong is a bug in Chromium.
Are you in a position to install Chrome Canary and see if that has the same issue or the latest ToT Chromium?
any chance you can try the above, @ksylor?
Hey @brendankenny thanks for the reminder! I downloaded Canary and I was able to get maybe 50% of my runs with Chrome Canary and the --only-categories=performance flag set. But I still am unable to do a full run, and seeing the same kind of hanging behavior where the inspector is detached but the browser is still open, or I get a similar error message as before:
statusEnd:verbose Running pass methods +0ms
status Gathering trace +0ms
listen for event =>:verbose Tracing.dataCollected +0ms
listen once for event =>:verbose Tracing.tracingComplete +0ms
method => browser:verbose Tracing.end +1ms
status Disconnecting from browser... +0ms
method => browser:verbose Storage.clearDataForOrigin {"origin":"https://www.etsy.com","storageTypes":"appcache,file_systems,indexeddb,local_storage,shader_cache,websql,service_workers,cac +0ms
GatherRunner disconnect:error not opened +0ms
statusEnd:verbose Disconnecting from browser... +0ms
(node:8623) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
ChromeLauncher Killing Chrome instance 8630 +279ms
Runtime error encountered: not opened
Error: not opened
at WebSocket.send (/Users/ksylormiller/.config/yarn/global/node_modules/ws/lib/WebSocket.js:344:18)
at CriConnection.sendRawMessage (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:167:14)
at CriConnection.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/connections/connection.js:65:10)
at Driver._innerSendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:442:29)
at /Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:416:35
at new Promise (<anonymous>)
at Driver.sendCommand (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:407:12)
at /Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:1371:12
at new Promise (<anonymous>)
at Driver.endTrace (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/driver.js:1365:12)
at Function.endRecording (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:290:28)
at Function.runPass (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:642:41)
at async Function.run (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:573:29)
at async Function._gatherArtifactsFromBrowser (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/runner.js:215:23)
at async Function.run (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-core/runner.js:81:21)
at async runLighthouse (/Users/ksylormiller/.config/yarn/global/node_modules/lighthouse/lighthouse-cli/run.js:193:26)
hmm, yeah, I'm not able to reproduce either. This will need some more investigation.
Perhaps related to: https://github.com/GoogleChrome/lighthouse/issues/10433
I see a very similar error when I try to run lighthouse(...) inside a loop. Even when they run one-by-one (in serial) the script eventually crashes with what appears to be this same stack trace.
FWIW @emersonthis we recommend you use a child process when running multiple times
const spawnSync = require('child_process').spawnSync;
const lighthouseCli = require.resolve('lighthouse/lighthouse-cli');
const {computeMedianRun} = require('lighthouse/lighthouse-core/lib/median-run.js');
const results = [];
for (let i = 0; i < 5; i++) {
console.log(`Running Lighthouse attempt #${i + 1}...`);
const {status = -1, stdout} = spawnSync('node', [
lighthouseCli,
'https://example.com',
'--output=json'
]);
if (status !== 0) {
console.log('Lighthouse failed, skipping run...');
continue;
}
results.push(JSON.parse(stdout));
}
const median = computeMedianRun(results);
console.log('Median performance score was', median.categories.performance.score * 100);
Thanks @patrickhulce. Does any of this advice change if I'm using the library programmatically? Here's the function I'm running on a list of URLs:
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
const runReport = async (url, outputFormat) => {
const chrome = await chromeLauncher.launch({chromeFlags: ['--headless']});
const options = {
output: outputFormat,
onlyCategories: ['performance'],
port: chrome.port
};
const runnerResult = await lighthouse(url, options);
console.log('Report is done for', runnerResult.lhr.finalUrl);
console.log('Performance score was', runnerResult.lhr.categories.performance.score * 100);
await chrome.kill();
return runnerResult;
};
For any situation where all you're using is the .lhr or .report output, we'd recommend you use a child process for any long-lived use cases.
I think I might be running into the same issue. This crashes most of time time:
node lighthouse-cli/index.js https://www.shopkeep.com/ --output html --view --verbose
Lighthouse version: 8fd7551d Chrome version: 86.0.4229.0
Chrome crashes like this:
I changed the spawn call in node_modules/chrome-launcher to "inherit" the process output. This is the end of the log:
Driver:verbose CSS.disable +0ms
method => browser:verbose CSS.disable +0ms
method <= browser OK:verbose DOMSnapshot.disable {} +0ms
method <= browser OK:verbose DOM.disable {} +0ms
method <= browser OK:verbose CSS.disable {} +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
<= event:verbose Debugger.scriptParsed {"scriptId":"173","url":"","startLine":0,"startColumn":0,"endLine":19,"endColumn":10,"executionContextId":9,"hash":"274fd05a04bb56752df1e0b81ee5c181265bcfc9","executionContextAuxData": +1ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"undefined"}} +0ms
statusEnd:verbose Gathering: FontSize +0ms
status Gathering: EmbeddedContent +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +1ms
<= event:verbose Debugger.scriptParsed {"scriptId":"174","url":"","startLine":0,"startColumn":0,"endLine":57,"endColumn":10,"executionContextId":4,"hash":"12f6243c080e5b4c433aa368c5df60f622decc09","executionContextAuxData": +2ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"object","value":[]}} +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
<= event:verbose Debugger.scriptParsed {"scriptId":"175","url":"","startLine":0,"startColumn":0,"endLine":19,"endColumn":10,"executionContextId":9,"hash":"274fd05a04bb56752df1e0b81ee5c181265bcfc9","executionContextAuxData": +1ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"undefined"}} +0ms
statusEnd:verbose Gathering: EmbeddedContent +0ms
status Gathering: RobotsTxt +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
<= event:verbose Debugger.scriptParsed {"scriptId":"176","url":"","startLine":0,"startColumn":0,"endLine":31,"endColumn":10,"executionContextId":9,"hash":"16ef4efa34e8bfa16428449d232a70d554d0e733","executionContextAuxData": +2ms
<= event:verbose Network.requestWillBeSent {"requestId":"5923.178","loaderId":"A05F16F73C52917C31FC00C31B922C43","documentURL":"https://www.shopkeep.com/","request":{"url":"https://www.shopkeep.com/robots.txt","method":"GET +0ms
<= event:verbose Network.requestWillBeSentExtraInfo {"requestId":"5923.178","associatedCookies":[{"blockedReasons":["NotOnPath"],"cookie":{"name":"_sk_page_referrer","value":"https%3A%2F%2Fwww.shopkeep.com%2F","domain":"www +0ms
<= event:verbose Network.responseReceivedExtraInfo {"requestId":"5923.178","blockedCookies":[],"headers":{"status":"200","server":"nginx","date":"Mon, 10 Aug 2020 16:07:13 GMT","content-type":"text/plain","vary":"Accept-Enc +99ms
<= event:verbose Network.responseReceived {"requestId":"5923.178","loaderId":"A05F16F73C52917C31FC00C31B922C43","timestamp":244420.930862,"type":"Fetch","response":{"url":"https://www.shopkeep.com/robots.txt","status":200," +2ms
<= event:verbose Network.dataReceived {"requestId":"5923.178","timestamp":244420.931313,"dataLength":501,"encodedDataLength":184} +0ms
<= event:verbose Network.loadingFinished {"requestId":"5923.178","timestamp":244420.930279,"encodedDataLength":359,"shouldReportCorbBlocking":false} +0ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"object","value":{"status":200,"content":"User-agent: *\r\n\r\nDisallow: /wp-admin/\r\nAllow: /wp-admin/*.js*\r\nAllow: /wp-admin/*.css*\r\nAllow: /wp-admin/*. +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
<= event:verbose Debugger.scriptParsed {"scriptId":"177","url":"","startLine":0,"startColumn":0,"endLine":19,"endColumn":10,"executionContextId":9,"hash":"274fd05a04bb56752df1e0b81ee5c181265bcfc9","executionContextAuxData": +1ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"undefined"}} +0ms
statusEnd:verbose Gathering: RobotsTxt +0ms
status Gathering: TapTargets +0ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
<= event:verbose Debugger.scriptParsed {"scriptId":"178","url":"","startLine":0,"startColumn":0,"endLine":370,"endColumn":10,"executionContextId":9,"hash":"00f7dfd526e13ce76334cae0236814c404965476","executionContextAuxData" +20ms
method <= browser OK:verbose Runtime.evaluate {"result":{"type":"object","value":[{"clientRects":[{"width":123,"height":22.65625,"left":117.46875,"top":14.171875,"right":240.46875,"bottom":36.828125},{"width":123,"height":2 +1ms
method => browser:verbose Runtime.evaluate {"expression":"(function wrapInNativePromise() {\n const __nativePromise = window.__nativePromise || Promise;\n const URL = window.__nativeURL || window.URL;\n +0ms
#
# Fatal error in , line 0
# ignored
#
#
#
#FailureMessage Object: 0x7ffee63e29700 Google Chrome Framework 0x000000010aa0d159 ChromeMain + 18375049
1 Google Chrome Framework 0x000000010e6c9ae3 ChromeMain + 82062099
2 Google Chrome Framework 0x00000001109a15eb ChromeMain + 118597147
3 Google Chrome Framework 0x00000001109921d1 ChromeMain + 118534657
4 Google Chrome Framework 0x000000010a29fbe6 ChromeMain + 10587158
5 Google Chrome Framework 0x000000010a123bb9 ChromeMain + 9030633
6 Google Chrome Framework 0x000000010a36e9fd ChromeMain + 11434541
7 Google Chrome Framework 0x000000010a6ad5d8 ChromeMain + 14837256
8 Google Chrome Framework 0x000000010a642bb8 ChromeMain + 14400488
9 Google Chrome Framework 0x000000010a642195 ChromeMain + 14397893
[0810/170713.714365:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffee63e6000, 0x2000): (os/kern) invalid address (1)
<= event:verbose Target.detachedFromTarget {"sessionId":"986D909361DE78116783957ED5123CBB","targetId":"66C42470442B72682585F28E1E2DDA8C"} +195ms
<= event:verbose Target.detachedFromTarget {"sessionId":"F16A3925A345993A9829C79A74A180E0","targetId":"33D7539F6CB0CFADD39AF034B5DD87D0"} +2ms
<= event:verbose Target.detachedFromTarget {"sessionId":"A42E2560DB4340C035E239A2657A50F4","targetId":"908195DF1C4519CBA51D718EEEA30CA6"} +2ms
<= event:verbose Inspector.targetCrashed {} +4ms
status Disconnecting from browser... +60s
method => browser:verbose Storage.clearDataForOrigin {"origin":"https://www.shopkeep.com","storageTypes":"appcache,file_systems,indexeddb,local_storage,shader_cache,websql,service_workers,cache_storage"} +0ms
ChromeLauncher Killing Chrome instance 5905 +5ms
method <= browser OK:verbose Storage.clearDataForOrigin {} +0ms
<= event:verbose Inspector.detached {"reason":"target_closed"} +27ms
statusEnd:verbose Disconnecting from browser... +27ms
Runtime error encountered: Waiting for DevTools protocol response has exceeded the allotted time. (Method: Runtime.evaluate)
LHError: PROTOCOL_TIMEOUT
at Timeout._onTimeout (/Users/mattzeunert/projects/lighthouse/lighthouse-core/gather/driver.js:352:21)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
This also happens quite consistently on WebPageTest, but only when running Lighthouse.
Most of the time only running the performance audits fixes the issue, but not always.
I've run into this on both my MacBook Pro and a Linux VM.
Instead of # ignored I've also seen # unreachable code.
Update 13 July: I've noticed this happens a lot less when using Lighthouse 6.1.1 rather than 6.2.0.
Do you have any advice on what I can do here? I'm seeing this error on about 4% of tests right now.
Should I report it as a Chromium bug? I can only repro when running Lighthouse though.
I had trouble reproing it :/ but if you're able to isolate it to a particular gatherer step to find a minified repro then a Chromium bug of that protocol command sequence would be awesome.
Nothing Lighthouse does should crash Chrome since we're just using the protocol, and in the end there's nothing we can really do if Chrome is crashing, but I doubt the bug will be very actionable without a narrower scope that all of Lighthouse.
From that log, it might be the TapTargets evaluateAsync script? I hope this helps!
Thanks a lot @patrickhulce! I've added tap-targets to skipAudits now and so far it seems to fix the problem! (Update: crashing maybe 1% of the time now.)
I tried pasting the gatherer expression in Chrome, but that didn't crash anything.
Does this mean you are working on my site?
-----Original Message----- From: Matt Zeunert [email protected] To: GoogleChrome/lighthouse [email protected] Cc: Subscribed [email protected] Sent: Mon, Aug 17, 2020 5:42 am Subject: Re: [GoogleChrome/lighthouse] Chrome crashes during run (#10794)
Do you have any advice on what I can do here? I'm seeing this error on about 4% of tests right now.Should I report it as a Chromium bug? I can only repro when running Lighthouse though.— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I'm still running into this, even with Chrome 89 and Lighthouse 7.0. Running the command from above on my laptop still reproduces the issue.
My current workarounds are 1) disabling the taptargets and sourcemaps gatherers and 2) disabling additional passes after the first one (sometimes the crash happens when going to about:blank at the start of a new pass).
Is there an existing Chrome bug for this? If I report one, is just the Lighthouse command a good enough repro step? I currently don't have a way to repro the issue without a full Lighthouse run.
Is there an existing Chrome bug for this?
Not that I'm aware of aside from me uploading crash reports from chrome://crashes and their IDs into the ether :)
If I report one, is just the Lighthouse command a good enough repro step? I currently don't have a way to repro the issue without a full Lighthouse run.
I'm not sure, honestly. My assumption was always "probably not", but if it's tagged with DevTools component for protocol usability maybe we can help work with the right folks to help us track the cause down?
Thanks Patrick!
I've filed a bug here: https://bugs.chromium.org/p/chromium/issues/detail?id=1162941
Tried out Chrome 91.0.4442.4 and so far it looks like Chrome is no longer crashing 🎉