Chromium over a pipe

Chromium over a pipe

LaraPaper renders screens with Browsershot, which starts Chromium through a Node.js script. By default, Puppeteer talks to Chromium over a WebSocket.

When a render takes longer than Browsershot’s 60 second timeout, the Node.js script is killed before it can close the browser. Over a WebSocket, Chromium keeps running and holds its memory until the container restarts. On a host that is short on memory, this can snowball: leftover Chromium processes slow the host down, the next render times out too, and eventually the host stops responding.

With this lab experiment enabled, local renders start Chromium with Browsershot’s pipe option. Chromium exits on its own as soon as the pipe closes, which happens when the Node.js script is gone.

Enable

  1. Sign in as the first user.
  2. Go to Settings → Lab and turn on Chromium over a pipe.

You can also set TOGGLE_PUPPETEER_PIPE=true instead of using the Lab UI. See Environment variables.

Scope

  • Applies to local renders: screen images and the default device images.
  • Renders on AWS Lambda (PUPPETEER_MODE=sidecar-aws) are unchanged.

When to turn it on

Turn it on if you see Chromium processes piling up after renders time out, or if memory usage on the host keeps growing until the container restarts.