ppodgorsek / docker-robot-framework

Robot Framework in Docker
https://cloud.docker.com/repository/docker/ppodgorsek/robot-framework
MIT License
333 stars 235 forks source link

Chromium sometimes won't start with a 'failed to connect to socket' error #457

Open crayfishuk opened 7 months ago

crayfishuk commented 7 months ago

Describe the bug On occasion (~10% of the time) we get an error where the first 'newPage' call within a test fails with an error launching chrome.

Example error from playwright-log.txt below:

{"level":30,"time":"2023-11-27T11:35:41.150Z","pid":24,"hostname":"gitlab-runner1","msg":"Start of node method newPage"}
{"level":30,"time":"2023-11-27T11:35:41.151Z","pid":24,"hostname":"gitlab-runner1","msg":"currentBrowser: undefined"}
{"level":30,"time":"2023-11-27T11:35:51.187Z","pid":24,"hostname":"gitlab-runner1","msg":"Error of node method  newPage"}
================= Original suppressed error =================
browserType.launch: Timeout 10000ms exceeded.
=========================== logs ===========================
<launching> /usr/local/lib/python3.11/site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/chromium-1064/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-LbdHmq --remote-debugging-pipe --no-startup-window
<launched> pid=90
[pid=90][err] [1127/113549.796622:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
============================================================
    at _newBrowser (/usr/local/lib/python3.11/site-packages/Browser/wrapper/index.js:9319:49)
    at PlaywrightState.getOrCreateActiveBrowser (/usr/local/lib/python3.11/site-packages/Browser/wrapper/index.js:9460:37)
    at newPage (/usr/local/lib/python3.11/site-packages/Browser/wrapper/index.js:9654:43)
    at PlaywrightServer.newPage (/usr/local/lib/python3.11/site-packages/Browser/wrapper/index.js:9987:34)
    at /usr/local/lib/python3.11/site-packages/Browser/wrapper/node_modules/@grpc/grpc-js/build/src/server.js:821:17
    at Http2ServerCallStream.safeDeserializeMessage (/usr/local/lib/python3.11/site-packages/Browser/wrapper/node_modules/@grpc/grpc-js/build/src/server-call.js:395:13)
    at ServerHttp2Stream.onEnd (/usr/local/lib/python3.11/site-packages/Browser/wrapper/node_modules/@grpc/grpc-js/build/src/server-call.js:382:22) {
  name: 'TimeoutError'
}

It then seems to recover and run - but the first tests have obviously failed and there are knock-on failures as a result.

To Reproduce Unknown - can't find a pattern.

We run it on a number of VMs - all Debian11, docker v 24.0.07 usng the following docker options:

docker run \
  --shm-size=1g \
  --user=${RF_UID:-0}:${RF_GID:-0} \
  --network host \
  -e ROBOT_OPTIONS="--name $NAME --include $TAGS --output output-$TAGS.xml" \
  -e HEADLESS=1 \
  -v ${PWD}:/opt/robotframework/tests \
  -v ${PWD}/results:/opt/robotframework/reports \
  ppodgorsek/robot-framework:latest

Expected behavior Not crash randomly, or produce a more useful (to us) error message?

Robot template Doesn't seem to matter what/which tests are run.

Screenshots n/a

Please provide any relevant information, such as:

Additional context n/a

ppodgorsek commented 4 months ago

Thank you @crayfishuk for the bug report. I'm trying to reproduce the error on my side, could you explain what the HEADLESS environment variable is for please? (the container itself is already headless, so I'm wondering if that could cause issues with more recent versions of Chrome which also support a headless mode)