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.

Crashes on Docker with emulated-form-factor=desktop

See original GitHub issue

Provide the steps to reproduce

  1. Use this Dockerfile
  2. Run LH with --emulated-form-factor=desktop and “heavy js page” like amazon.fr

Dockerfile:

FROM node:12.4-alpine

RUN apk add --update --no-cache chromium && rm -rf /var/cache/apk/*

docker-compose.yml

version: '3.5'

services:

  lh:
    build:
      context: ./docker/nodejs
    tty: true
    working_dir: /app
    volumes:
      - ./:/app

Note:

  • Same issue on many Dockerfiles (node:10*-alpine, node:10-slim, node:12-slim), using chromium or chrome…
  • No crash on my computer: Node 12 on Debien Stretch

What is the current behavior?

Inside docker shell:

./node_modules/.bin/lighthouse --emulated-form-factor=desktop --chrome-flags="--no-sandbox --headless --disable-gpu" https://www.amazon.fr/
  ChromeLauncher Waiting for browser. +0ms
  ChromeLauncher Waiting for browser... +0ms
  ChromeLauncher Waiting for browser..... +506ms
  ChromeLauncher Waiting for browser.....✓ +4ms
  status Connecting to browser +88ms
  status Resetting state with about:blank +11ms
  status Benchmarking machine +36ms
  status Initializing… +506ms
  status Resetting state with about:blank +32ms
  status Setting up network for the pass trace +35ms
  status Cleaning browser cache +2ms
  status Beginning devtoolsLog and trace +12ms
  status Loading page & waiting for onload CSSUsage, ViewportDimensions, RuntimeExceptions, ConsoleMessages, AnchorElements, ImageElements, LinkElements, MetaElements, ScriptElements, AppCacheManifest, Doctype, DOMStats, OptimizedImages, PasswordInputsWithPreventedPaste, ResponseCompression, TagsBlockingFirstPaint, FontSize, EmbeddedContent, RobotsTxt, TapTargets, Accessibility +3ms
  Driver:warn Timed out waiting for page load. Checking if page is hung... +45s
  Driver:warn Page appears to be hung, killing JavaScript... +1s
  status Disconnecting from browser... +30s
  ChromeLauncher Killing Chrome instance 416 +8ms
Runtime error encountered: Waiting for DevTools protocol response has exceeded the allotted time. (Method: Emulation.setScriptExecutionDisabled)
LHError: PROTOCOL_TIMEOUT
    at Timeout._onTimeout (/usr/local/lib/node_modules/lighthouse/lighthouse-core/gather/driver.js:399:21)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

What is the expected behavior?

No crashes with --emulated-form-factor=mobile

Environment Information

  • Lighthouse version: 4.0/4.1
  • Node.js version: 10/12.1/12.4
  • Operating System: Debian Stretch with Docker 18.09.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13

github_iconTop GitHub Comments

25reactions
felipe-vieiracommented, Apr 1, 2020

I’ve had the same issue and found a workaround. Apparently, chrome relies on shared memory which is mounted on /dev/shm, my alpine image default partition has only 64mb, so I had to mount it to a host volume: added the following to my docker-compose file:

services:
  lighthouse:
    volumes:
      - lighthouse-shm:/dev/shm
...
volumes:
  siteanalysis-dashboard-data:

After the volume is mounted, lighthouse completes normally.

12reactions
patrickhulcecommented, Sep 15, 2020

I was unable to reproduce this issue with https://github.com/GoogleChrome/lighthouse/issues/9212#issuecomment-607276050 or --disable-dev-shm-usage so we’ll consider that the solution here 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find out Why Your Docker Container Keeps Crashing
Your Docker container is exiting without a useful error message? Here are a few ways to find out what's happening.
Read more >
Docker crashing with fatal error
The crash seems to happen about 1-2 minutes after Docker Desktop is re-started, the only error shown is “Fatal Error” with the message...
Read more >
6 ways to debug an exploding Docker container - Medium
6 ways to debug an exploding Docker container. Everything crashes. Sometimes things crash when they're running inside a Docker container though, and then...
Read more >
Restart Docker container on inner process crash
Edit after question was updated with Dockerfile: The easiest way is probably to make sure run.sh crashes if any of it's subprocesses crash....
Read more >
CL (VC v19.24) crashes when building in a docker volume folder
I am trying to build a C++ project with visual studio 16.4.3 within a docker container on a folder within a docker volume,...
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