question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to properly kill a lighthouse process prematurely?

See original GitHub issue

Let’s say for some reason I want to kill the lighthouse process and all it’s child processes before the run has completed, how could I achieve this? In an asynchronous way would be best, so I can stop program execution until I know all the chrome processes have been killed properly.

Is it as simple as chrome.kill(), assuming chrome is an instance of chrome-launcher, and lighthouse is running on this via port ?

The reason I am doing this is because I want to run lots and lots of lighthouse instances sequentially in a single node.js process. It seems to work fairly smoothly and reliably if the lighthouse runs finish properly, but not so well if my custom timeout function fires, triggering chrome.kill and then going to the next url to audit.

I’m purposefully leaving out any error messages I have been getting so that the bot doesn’t pick them up and sideline me! 😉

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
upugo-devcommented, May 22, 2019

For anyone reading this, I’ve tried just about everything including execa(), bluebird, loads of promise/process libraries, with varying amounts of success (biased to our use-case) and found that the simplest way was to use chromelauncher, and just chrome.kill() instance when I need to abort. I have had to accept that some buffer time is necessary to ensure chrome dies and cleans up properly before trying the next run.

1reaction
patrickhulcecommented, May 17, 2019

If you just need the LHR object in memory (and not the artifacts) you can send the JSON output to stdout out and parse it in your node script to avoid hitting the filesystem.

One of our implementations does this for example and only pulls in the artifacts from disk for debug runs (see link below)

https://github.com/patrickhulce/dzl-lighthouse/blob/c77e0b37ca05777d24d3c232878c6987b2e855ab/cli/lib/collectors/local.js#L83-L101

And don’t forget you’re always free to write your own javascript file that invokes LH, puts the result wherever you need them to go and run that script in a separate process instead of LH directly too 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TIPS TO KILL THE NEW ROGUE SCAVS ON LIGHTHOUSE ...
12.12 has now gone live but the servers are taking a hit due to the resurgence of players, so this video breaks down...
Read more >
How do you kill OP shadows in the Lighthouse? - Pillars of ...
Initiate encounter with your pet/useless character and cast some DPS buffs with your priest. Kill those bustards with fire spells (druid or mage) ......
Read more >
Historic Lighthouse Preservation Handbook
General Guidelines for the Preservation Planning Process . ... Everyone learned very early just how quickly work could come to a stop when....
Read more >
Breaking Down the Cinematography of The Lighthouse
Acclaimed cinematographer Jarin Blaschke explaines how he achieved the haunting visuals of The Lighthouse through modern and antiquated techniques.
Read more >
Lighthouse Evolution and Typology - Sea Shell Shop
Many of the world's early lighthouses may have looked like this Roman lighthouse that still stands in Dover, England. The number of lights...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found