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.

Problem running containerized Lighthouse node 8 app in OpenShift

See original GitHub issue

Not exactly related to Lighthouse, but I’m hoping someone can point me in the right direction.

A simple node 8 application using the lighthouse and chrome-launcher npm modules to generate reports against a given URL.

Everything works locally, as well as docker-ized. However, when the same docker image is deployed in OpenShift, it doesn’t work.

Since everything runs with lowest permissions level in OpenShift, could this be some permissions issue? Or maybe some environment variable/parameter for Chrome is not set correctly, causing it to not start in headless mode etc?

Error Log

Lighthouse Test Service running on :::3000
Chrome Path: /usr/bin/google-chrome
Url to test: https://github.com
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher:verbose created /tmp
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher:verbose Launching with command:
"/usr/bin/google-chrome" --disable-translate --disable-background-networking --safebrowsing-disable-auto-update --disable-sync --metrics-recording-only --disable-default-apps --mute-audio --no-first-run --remote-debugging-port=36509 --user-data-dir=/tmp --disable-setuid-sandbox --headless --disable-gpu --no-sandbox about:blank
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher:verbose Chrome running with pid 6156 on port 36509.
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher Waiting for browser.
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher Waiting for browser...
Fri, 15 Dec 2017 21:23:57 GMT ChromeLauncher Waiting for browser.....
Fri, 15 Dec 2017 21:23:58 GMT ChromeLauncher Waiting for browser.......
Fri, 15 Dec 2017 21:23:59 GMT ChromeLauncher Waiting for browser.........
Fri, 15 Dec 2017 21:24:00 GMT ChromeLauncher Waiting for browser...........
Fri, 15 Dec 2017 21:24:00 GMT ChromeLauncher Waiting for browser.............
Fri, 15 Dec 2017 21:24:01 GMT ChromeLauncher Waiting for browser...............
Fri, 15 Dec 2017 21:24:03 GMT ChromeLauncher Waiting for browser.................
Fri, 15 Dec 2017 21:24:04 GMT ChromeLauncher Waiting for browser...................
Fri, 15 Dec 2017 21:24:05 GMT ChromeLauncher Waiting for browser.....................
Fri, 15 Dec 2017 21:24:06 GMT ChromeLauncher Waiting for browser.....................✓
Chrome listening on port: 36509
CWD: /

Fri, 15 Dec 2017 21:25:38 GMT CriConnection:error Timeout waiting for initial Debugger Protocol connection.
Fri, 15 Dec 2017 21:25:43 GMT CriConnection:warn Cannot create new tab; reusing open tab.
Fri, 15 Dec 2017 21:26:01 GMT CriConnection:error Timeout waiting for initial Debugger Protocol connection.
Fri, 15 Dec 2017 21:26:05 GMT status Disconnecting from browser...
Fri, 15 Dec 2017 21:26:07 GMT CriConnection:warn disconnect() was called without an established connection.
{ Error: Timeout waiting for initial Debugger Protocol connection.
    at ClientRequest.request.setTimeout._ (/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:118:21)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at ClientRequest.emit (events.js:208:7)
    at Socket.emitTimeout (_http_client.js:708:34)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at Socket.emit (events.js:208:7)
    at Socket._onTimeout (net.js:407:8)
    at ontimeout (timers.js:475:11) code: 'CRI_TIMEOUT' }

These errors, specifically, look suspicious:

Fri, 15 Dec 2017 21:25:38 GMT CriConnection:error Timeout waiting for initial Debugger Protocol connection.
Fri, 15 Dec 2017 21:25:43 GMT CriConnection:warn Cannot create new tab; reusing open tab.

printenv (removed all the kubernetes/openshift vars)

I have no name!@lighthousedemo-1-pw9nq:/$ printenv                                                                    
NODE_VERSION=8.9.3                                                                                                          
HOSTNAME=lighthousedemo-1-pw9nq                                                                                       
TERM=xterm                                                                                                                  
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin                                                           
PWD=/                                                                                                                       
SHLVL=1                                                                                                                     
APP_PORT=3000                                                                                                               
HOME=/                                                                                                                      
YARN_VERSION=1.3.2                                                                                                          
CI=true                                                                                                                     

I have no name!@lighthousedemo-1-pw9nq:/$ google-chrome --version                                                     
mkdir: cannot create directory '//.local': Permission denied                                                                
touch: cannot touch '//.local/share/applications/mimeapps.list': No such file or directory                                  
Google Chrome 64.0.3282.24 dev                                                                                              

ps

I have no name!@lighthousedemo-1-pw9nq:/$ ps -ef                                                                      
UID         PID   PPID  C STIME TTY          TIME CMD                                                                       
1000690+      1      0  0 20:09 ?        00:00:04 node index.js                                                             
1000690+     30      1  0 20:09 ?        00:00:00 [cat] <defunct>                                                           
1000690+     31      1  0 20:09 ?        00:00:00 [cat] <defunct>                                                           
1000690+   5829      0  0 21:20 ?        00:00:00 /bin/sh -i -c TERM=xterm /bin/sh                                          
1000690+   5835   5829  0 21:20 ?        00:00:00 /bin/sh                                                                   
1000690+   5836   5835  0 21:20 ?        00:00:00 bash                                                                      
1000690+   6156      1  4 21:23 ?        00:00:05 /usr/bin/google-chrome --disable-translate --disable-background-networking
1000690+   6166   6156  0 21:23 ?        00:00:00 cat                                                                       
1000690+   6167   6156  0 21:23 ?        00:00:00 cat                                                                       
1000690+   6169   6156  0 21:23 ?        00:00:00 /opt/google/chrome-unstable/chrome --type=zygote --headless --no-sandbox -
1000690+   6219   6169  0 21:24 ?        00:00:00 /opt/google/chrome-unstable/chrome --type=renderer --no-sandbox --use-gl=s
1000690+   6241   6169  0 21:25 ?        00:00:00 /opt/google/chrome-unstable/chrome --type=renderer --no-sandbox --use-gl=s

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
patrickhulcecommented, Dec 19, 2017

Glad you got it sorted out and thanks for sharing the solution for future puzzled folks 😃

1reaction
kodeninjacommented, Dec 19, 2017

@patrickhulce nvm, I got it to work! I hadn’t put in the resources section in the OpenShift deployment config, so there wasn’t enough room for Chrome to come up and work 😁.

Thanks for all your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 7. Troubleshooting OpenShift Container Platform 4.8
Ensure that the proxy configuration meets OpenShift Container Platform installation requirements. 7.1.8. Investigating control plane node installation issues.
Read more >
Troubleshooting CRI-O container runtime issues
Accessing cluster nodes using SSH is not recommended and nodes will be tainted as accessed. However, if the OpenShift Container Platform API is...
Read more >
Storing data on software-defined storage (SDS) with Portworx
One of the biggest challenges when you run stateful apps in a cluster is to make sure that your container can be rescheduled...
Read more >
Keycloak Container image - Quay.io
docker run quay.io/keycloak/keycloak start-dev. Documentation. For more information check out the container guide, and other server guides.
Read more >
8 Cloud-based Kubernetes and Docker Monitoring Solutions
It can package software applications along with their dependencies. It also stores them in a virtual container that can run on Windows, Linux,...
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