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

Intermittent connection reset events #1931

Closed
pmeenan opened this issue Mar 29, 2017 · 6 comments
Closed

Intermittent connection reset events #1931

pmeenan opened this issue Mar 29, 2017 · 6 comments

Comments

@pmeenan
Copy link

pmeenan commented Mar 29, 2017

It seems to only impact Windows but connecting to an already-running Chrome instance sometimes throws:

9:15:59.562 - lighthouse --disable-cpu-throttling --disable-network-throttling --port 9222 --output html --output json --verbose --output-path "C:\src\wptagent\work\pat\170329_DA_80229d364d611c8214cd12e32992d3c2.1.0\lighthouse.json" "http://www.webpagetest.org/?bare=1"
  Lighthouse CLI:verbose Using supplied port 9222 +0ms
  Lighthouse:warn The URL provided should be on HTTPS +253ms
  Lighthouse:warn Performance stats will be skewed redirecting from HTTP to HTTPS. +3ms
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1029:11)
    at TCP.onread (net.js:575:26)

It always throws at the same point and time (when initially connecting) and sometimes adding a delay before running lighthouse helps but sometimes not.

Right now WebPageTest polls the /json dev tools interface waiting for the browser to become available before launching lighthouse (otherwise it gets the same error reliably).

It might be worthwhile to add some redundancy to the initial connection establishment when passed an explicit port and retry for several seconds until it is successfully connected.

@patrickhulce
Copy link
Collaborator

+1, We only poll for Chrome to be ready when we launch it ourselves, but would be nice to support this for passed in ports too with a reasonable timeout.

@brendankenny
Copy link
Member

brendankenny commented Mar 29, 2017

We can easily replace .isDebuggerReady() with .waitUntilReady() here, but I guess the question is how many retries to do. It is nice to fail immediately when running with --skip-autolaunch and you don't have Chrome open, but I guess that's not that common a use case

@wardpeet
Copy link
Collaborator

at the moment waitUntilReady is configured to retry 10 and poll on an interval of 500ms but we can easily make the retry count editable to support skip-autolaunch

@ebidel
Copy link
Contributor

ebidel commented Apr 30, 2017

Also seeing this on Mac when running --headless, before killing chrome:

  const launcher = new ChromeLauncher({port: 9222, additionalFlags: [ '--headless']});

  launcher.run()
    .then(() => lighthouse(url, flags))
    .then(results => {
      return new Promise(resolve => {
        setTimeout(() => {
          resolve(results);
        }, 10); // Introduce slight delay before killing Chrome.
      });
    })
    .then(results => launcher.kill().then(() => results))
    .catch(err => {
      return launcher.kill().then(() => {
        throw err;
      });
    });

@paulirish
Copy link
Member

Can likely dupe to ECONNECTREFUSED bug.. and resolved with https://github.com/GoogleChrome/lighthouse/compare/browserws

@paulirish
Copy link
Member

Nearly certain this is fixed by now. Launcher is a lot more robust. Holler if its still an issue. :)

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

No branches or pull requests

6 participants