Playwright: [Feature] Launch doctor

Created on 28 Jun 2020  路  18Comments  路  Source: microsoft/playwright

Give us a script that we could use in the target environment that would tell us if Playwright will work there of point to the missing dependencies, libraries or arguments we need to pass into it.

Categorization of linked bugs:

The scope of this bug:

  • [x] Linux

    • [x] missing dependencies

    • [x] missing libraries

    • [x] Chromium sandboxing - approach

    • [x] libc version mismatch for Firefox when running on Ubuntu 16

    • [x] Ubuntu 20.04 WebKit support

  • [x] Windows

    • [x] missing media pack (Windows N, Server)

    • [x] missing C Runtime Redistributable

    • [x] missing DLLs

  • [x] Mac - no problems so far with Mac.
v1.3

Most helpful comment

Sandboxing Chromium on Linux

Sandbox issues happen occasionally in different linux environments when launching Chromium. Notably:

  • without a properly configured seccomp profile for docker
  • under root users in Linux (happens a lot in Docker as well)
  • without enabled user namespace cloning in VMs (e.g. travis requires extra settings there in .travis.yml).

While tackling sandboxing, our users face with the following issues:

  • getting lost in setting up sandbox following our instructions. Notably, it looks like SUID sandbox is no longer functional. #2386
  • facing long error logs with error Protocol error (Target.setAutoAttach): Target closed. that doesn't surface sandboxing issue. #1887
  • using args launch arguments for Chromium that doesn't port to other browsers. As a result, using the same launch options for webkit crashes webkit.

We considered running Chromium with --no-sandbox by default, or auto-detecting docker and adding --no-sandbox in docker only. Both are very strong measures: there are services that start containers with a nice seccomp profile (e.g. Circle CI) that we don't want to regress.

Instead, we suggest the following:

  • [x] update sandboxing documentations
  • [x] detect running under root, auto-add --no-sandbox there and print a warning into the terminal.
  • [x] provide the chromiumSandbox launch option instead of asking users to run with args: ['--no-sandbox']
  • [x] detect sandbox startup failures and surface the error nicely

All 18 comments

In addition to finding missing dependencies, this tool can also check for OS compatibility: eg. Firefox needs Ubuntu 18+. For example: #2738.

Maybe WebKit on Heroku which crashes is also caused by not having all the dependencies installed:
https://github.com/mxschmitt/heroku-playwright-buildpack/issues/2

Discussion: https://playwright.slack.com/archives/C0141EZ6ZNH/p1593729511002600?thread_ts=1593729511.002600&cid=C0141EZ6ZNH

We can try it out once its ready.

Sandboxing Chromium on Linux

Sandbox issues happen occasionally in different linux environments when launching Chromium. Notably:

  • without a properly configured seccomp profile for docker
  • under root users in Linux (happens a lot in Docker as well)
  • without enabled user namespace cloning in VMs (e.g. travis requires extra settings there in .travis.yml).

While tackling sandboxing, our users face with the following issues:

  • getting lost in setting up sandbox following our instructions. Notably, it looks like SUID sandbox is no longer functional. #2386
  • facing long error logs with error Protocol error (Target.setAutoAttach): Target closed. that doesn't surface sandboxing issue. #1887
  • using args launch arguments for Chromium that doesn't port to other browsers. As a result, using the same launch options for webkit crashes webkit.

We considered running Chromium with --no-sandbox by default, or auto-detecting docker and adding --no-sandbox in docker only. Both are very strong measures: there are services that start containers with a nice seccomp profile (e.g. Circle CI) that we don't want to regress.

Instead, we suggest the following:

  • [x] update sandboxing documentations
  • [x] detect running under root, auto-add --no-sandbox there and print a warning into the terminal.
  • [x] provide the chromiumSandbox launch option instead of asking users to run with args: ['--no-sandbox']
  • [x] detect sandbox startup failures and surface the error nicely

@aslushnikov for Heroku we need also the --no-sandbox flag but on their environments it's not running as root.
Any way of detecting a not functional sandbox in such a case? (Since in your PR we add the parameter only if user ID is 0)

Any way of detecting a not functional sandbox in such a case?

@mxschmitt The only reliable way for me so far was running Chromium and seeing if it crashes =/ I'd like to look into Heroku to see what happens there - would I be able to do it on a free account? Can i SSH into their environment?

Any way of detecting a not functional sandbox in such a case?

@mxschmitt The only reliable way for me so far was running Chromium and seeing if it crashes =/ I'd like to look into Heroku to see what happens there - would I be able to do it on a free account? Can i SSH into their environment?

@aslushnikov sure, can you ping me via Slack? "Max Schmitt" thanks!

Was this page helpful?
0 / 5 - 0 ratings