Skip to content

Conversation

@samccone
Copy link
Contributor

@samccone samccone commented May 25, 2017

It is possible that we were resolving the gather chain before we had
disconnected. When manually launching and killing chrome this can race
and result in an error to the user.

This fixes that problem. \o/.

Fixes #2337


Test plan:

Run launcher with:

const lighthouse = require('lighthouse');

import {launch} from './chrome-launcher';

async function runLighthouse(url: string) {
  const opts = {
    chromeFlags: ['--headless'],
  };
  const chrome = await launch(opts);
  const flags = {
    output: 'json',
    port: chrome.port,
  };

  const results = await lighthouse(url, flags);

  process.on('uncaughtException', (e: any) => {
    console.log(e);
  });

  await chrome.kill();
  return results;
}

runLighthouse('https://example.com');

Without this patch, and then run it with the patch. Observe it now working.

It is possible that we were resolving the gather chain before we had
disconnected. When manually launching and killing chrome this can race
and result in an error to the user.

This fixes that problem. \o/.

Fixes #2337

---

Test plan:

Run launcher with:

```ts
const lighthouse = require('lighthouse');

import {launch} from './chrome-launcher';

async function runLighthouse(url: string) {
  const opts = {
    chromeFlags: ['--headless'],
  };
  const chrome = await launch(opts);
  const flags = {
    output: 'json',
    port: chrome.port,
  };

  const results = await lighthouse(url, flags);

  process.on('uncaughtException', (e: any) => {
    console.log(e);
  });

  await chrome.kill();
  return results;
}

runLighthouse('https://example.com');
```

Without this patch, and then run it with the patch. Observe it now
working.
Copy link
Contributor

@ebidel ebidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified!

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was inevitable :) I was occasionally seeing the same error while running plots (no headless) on Linux

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chromelauncher error on when killing instance

3 participants