Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂️ PROTOCOL_TIMEOUT #6512

Open
patrickhulce opened this issue Nov 9, 2018 · 361 comments
Open

☂️ PROTOCOL_TIMEOUT #6512

patrickhulce opened this issue Nov 9, 2018 · 361 comments
Assignees
Labels

Comments

@patrickhulce
Copy link
Collaborator

patrickhulce commented Nov 9, 2018

tl;dr - Chrome sometimes stops responding, most commonly when trying to clear the cache, so uncheck "Clear storage" and try again.

Explanation
This is the umbrella ☂️ issue for all PROTOCOL_TIMEOUT error reports. We're collecting all of them in a single place so that we can easily identify which protocol methods are most problematic to prioritize to Chromium domain owners.

PROTOCOL_TIMEOUT refers to the situation when Lighthouse has been waiting for Chrome to respond to a single command for more than 30 seconds. PROTOCOL refers to the Chrome DevTools Protocol connection that Lighthouse uses to talk to Chrome.

If you experienced a protocol timeout issue, please just comment here with the method name, e.g. Network.clearBrowserCache

More recent update: #6512 (comment)

@patrickhulce patrickhulce changed the title PROTOCOL_TIMEOUT ☂️ PROTOCOL_TIMEOUT Nov 9, 2018
@kinggolf
Copy link

kinggolf commented Dec 3, 2018

Lighthouse Version: 3.3.0.4001
Lighthouse Commit: 6610036
Chrome Version: 70.0.3538.110
Initial URL: https://golftocs.com/
Error Message: PROTOCOL_TIMEOUT Method: Storage.clearDataForOrigin
Stack Trace:

LHError: PROTOCOL_TIMEOUT Method: Storage.clearDataForOrigin
    at _ (chrome-extension://blipmdconlkpinefehnmjammfjpmpbjk/scripts/lighthouse-ext-bundle.js:18993:11)

Very strange - I just ran LightHouse successfully 2 days ago on this site.

@Moro-Code
Copy link

As a temporary solution, is there a way to increase this timeout ?

@adamraine
Copy link
Member

No (unless you want to modify the source code). The timeout is 30s which is very generous for most protocol requests. If you are experiencing this error, I wouldn't expect increasing the timeout beyond 30s to fix it.

https://github.com/GoogleChrome/lighthouse/blob/3a0c62da351a6453ceda00b3bae267527b2815e2/core/gather/session.js#L11C1-L12

@Moro-Code
Copy link

Is there a way to catch this error at least ? I have tried to get around this by adding some retry logic but to no avail. The error somehow gets around the try catch block and a .catch statement to kill the whole process

const runLighthouseTest = async (page, urlPath, options, config, maxRetries = 3) => {
  let retries = 0;
  while (retries < maxRetries) {
    try {
      const result = await lighthouse(`${baseUrl}${urlPath}`, options, config, page).catch(
        error => {
          throw error;
        }
      );
      return result;
    } catch (error) {
      logger.error(
        `Lighthouse test for page ${urlPath} failed on attempt ${retries + 1}: ${error}`
      );
      retries++;
      if (retries === maxRetries) {
        throw new Error(
          `Failed to run Lighthouse test for page ${urlPath} after ${maxRetries} attempts`
        );
      }
    }
  }
};

@patrickhulce
Copy link
Collaborator Author

The error somehow gets around the try catch block and a .catch statement to kill the whole process

@Moro-Code try adding an uncaught rejection handler.

@Moro-Code
Copy link

@patrickhulce while this would prevent the script from crashing not sure how I would initiate a retry of running a report using this method

@JWebDev
Copy link
Contributor

JWebDev commented May 29, 2023

Today i had the same case run Lighthouse programmatically in Docker. Local and from CMD was everything fine. --disable-dev-shm-usage helped me.
I'm starting Chrome in Docker with:

//Launch Chrome
    return await launch({
        chromeFlags: ['--headless', '--no-sandbox', '--disable-gpu', '--disable-dev-shm-usage'],
        logLevel: 'info',
        chromePath: '/usr/bin/google-chrome'
    })

@StrongGuo
Copy link

Extension Error: PROTOCOL_TIMEOUT Method: Network.emulateNetworkConditions

@guillermovidalf
Copy link

Same issue here using sitespeed:
[2023-06-22 12:22:45] ERROR: Lighthouse could not test https://www.amazon.es/ please create an upstream issue: https://github.com/GoogleChrome/lighthouse/issues/new?assignees=&labels=bug&template=bug-report.yml LighthouseError: PROTOCOL_TIMEOUT
at file:///lighthouse/node_modules/lighthouse/core/gather/session.js:91:47
at new Promise ()
at ProtocolSession.sendCommand (file:///lighthouse/node_modules/lighthouse/core/gather/session.js:87:28)
at file:///lighthouse/node_modules/lighthouse/core/gather/driver/prepare.js:48:19
at _navigation (file:///lighthouse/node_modules/lighthouse/core/gather/navigation-runner.js:255:9)
at async _navigations (file:///lighthouse/node_modules/lighthouse/core/gather/navigation-runner.js:297:30)
at async file:///lighthouse/node_modules/lighthouse/core/gather/navigation-runner.js:370:27
at async Runner.gather (file:///lighthouse/node_modules/lighthouse/core/runner.js:218:21)
at async navigationGather (file:///lighthouse/node_modules/lighthouse/core/gather/navigation-runner.js:343:21)
at async navigation (file:///lighthouse/node_modules/lighthouse/core/index.js:95:24)
at async runLighthouse (file:///lighthouse/runLighthouse.js:21:14)
at async LighthousePlugin.processMessage (file:///lighthouse/index.js:184:20)

ardelato added a commit to iFixit/lighthouse-docker that referenced this issue Jun 29, 2023
I ran into some issues attempting to run the current image of lighthouse
through the python script. In order to fix this I needed to update the
lighthouse dockerfile.

This updates the lighthouse dockerfile to use Node.js 18-slim instead
of Alpine. This will also install the latest version of lighthouse
which is currently on version 10.3.0.

Lastly this will set a couple of environment variables to configure
Chromium. The `CHROME_PATH` is needed so
that lighthouse will know where to find Chromium. This will also set
the some flags for the chromium browser so we don't need to manually
set them when running lighthouse. The flags will ensure chromium
runs in headless mode and will disable the sandbox which is need when
the container is ran as root. I also needed to
add the flag "--disable-dev-shm-usage" to prevent chromium from
crashing when running in docker.
GoogleChrome/lighthouse#6512 (comment)
@ihorbond
Copy link

Method: Emulation.setScriptExecutionDisabled

@mcbuddy
Copy link

mcbuddy commented Dec 8, 2023

Method: Runtime.evaluate

@ali-habibzadeh
Copy link

ali-habibzadeh commented Jan 23, 2024

This is so frustrating. It just doesn't work at scale. Constantly getting this protocol error and getting this since 2018.

{
   "code":"PROTOCOL_TIMEOUT",
   "friendlyMessage":{
      "i18nId":"core/lib/lh-error.js | protocolTimeout",
      "values":{
         "errorCode":"PROTOCOL_TIMEOUT",
         "protocolMethod":"Target.setAutoAttach"
      },
      "formattedDefault":"Waiting for DevTools protocol response has exceeded the allotted time. (Method: Target.setAutoAttach)"
   },
   "lhrRuntimeError":true,
   "protocolMethod":"Target.setAutoAttach"
}

@eschneider1271
Copy link

Method: Page.enable

Was hitting this timeout since upgrading from lighthouse 11.0.0 to 11.5.0. Rolling back to 11.4.0 resolved the issue for me, FWIW.

@philipp-winterle
Copy link

friendlyMessage: 'Waiting for DevTools protocol response has exceeded the allotted time. (Method: Emulation.setScriptExecutionDisabled)', lhrRuntimeError: true, protocolMethod: 'Emulation.setScriptExecutionDisabled'

@Dgacarda
Copy link

{ "code":"PROTOCOL_TIMEOUT", "friendlyMessage": "Waiting for DevTools protocol response has exceeded the allotted time. (Method: Emulation.setScriptExecutionDisabled)", "level": "error", "lhrRuntimeError": true, "protocolMethod": "Debugger.disable" }

"lighthouse": "11.6.0"

@rggammon
Copy link

rggammon commented Apr 2, 2024

Runtime.evaluate from getBenchmarkIndex

@TsvetoslavVasev
Copy link

TsvetoslavVasev commented May 21, 2024

Method: Debugger.disable

@adamraine adamraine mentioned this issue Jun 10, 2024
3 tasks
@wpniederer
Copy link

Method: Network.getResponseBody

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.