boyney123 / garie-lighthouse

Lighthouse Garie plugin. Polls websites to checkout performance metrics also supports webhooks.
MIT License
50 stars 24 forks source link

chrome defunct processes #5

Closed TomVanBerlo closed 5 years ago

TomVanBerlo commented 5 years ago

I recently installed garie via the docker-compose file included in https://github.com/boyney123/garie. But after a while it stops collecting metrics. I pinned down the issue to zombie processes from 'chrome' and 'cat' using all resources. After some more searching it turns out that the 'npm' process runs as pid 1. This pid is normally reserved for the init process that reaps zombies. A better explanation can be found at https://github.com/Yelp/dumb-init. My proposed solution is to install dumb-init in the Dockerfile.

diff --git a/Dockerfile b/Dockerfile
index e649d43..8e9b599 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,7 +12,7 @@ RUN \
     wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
     sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
     apt-get update && \
-    apt-get install -y google-chrome-stable
+    apt-get install -y google-chrome-stable dumb-init

 COPY . .
GerardSmit commented 5 years ago

Is this relevent to the errors in my logging, or should I create a new issue for this?

error: Failed to get data for https://example.com {"stack":"Error: spawnSync /bin/sh ENOSPC
    at _errnoException (util.js:1022:11)
    at spawnSync (child_process.js:579:20)
    at execSync (child_process.js:635:13)
    at findChromeExecutables (/usr/src/garie-lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:201:25)
    at desktopInstallationFolders.forEach.folder (/usr/src/garie-lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:87:46)
    at Array.forEach (<anonymous>)
    at Object.linux (/usr/src/garie-lighthouse/node_modules/chrome-launcher/dist/chrome-finder.js:86:32)
    at Launcher.<anonymous> (/usr/src/garie-lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:139:80)
    at Generator.next (<anonymous>)
    at /usr/src/garie-lighthouse/node_modules/chrome-launcher/dist/chrome-launcher.js:12:71","timestamp":"2018-11-25T14:30:00.192Z"}

Thanks in advance.

GerardSmit commented 5 years ago

I've build PR #6 and can confirm that the errors are relevent to this issue.

@boyney123 I don't know if you have time to maintain this project, but this is quite an important issue since it spawns many zombie processes that I even couldn't access my server.

gschoenberger commented 5 years ago

Any update on this issue? We are hitting the same issue...

boyney123 commented 5 years ago

Hey @gschoenberger @GerardSmit @TomVanBerlo

Sorry its taken so long, I have merged in the PR to fix this and released the Docker image 2.0 👍

boyney123 commented 5 years ago

Let me know if you still have issues.

On another note if anybody wants to help maintain Garie, feel free to get in contact! :)