2

I'm getting this error when I'm running long test cases. mainly this happens with Jenkins.

OS : Ubuntu 18.04

Docker Version: 19.03.8

Docker API version: 1.40

No Of Containers : 4

RAM : 30GB

Processor : i7 9700k

browsers.json

    {
    "chrome": {
        "default": "81.0",
        "versions": {
            "81.0": {
                "image": "selenoid/vnc:chrome_81.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            },
            "80.0": {
                "image": "selenoid/vnc:chrome_80.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            },
            "79.0": {
                "image": "selenoid/vnc:chrome_79.0",
                "port": "4444",
                "path": "/",
                "shmSize" : 1068435456
            }
        }
    }
}

Error output:

  { TimeoutError: timeout: Timed out receiving message from renderer: 300.000
    matchdciprotractor_1   |   (Session info: chrome=81.0.4044.92)
    matchdciprotractor_1   |   (Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 5.3.0-46-generic x86_64)
    matchdciprotractor_1   |     at Object.checkLegacyResponse (/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    matchdciprotractor_1   |     at parseHttpResponse (/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    matchdciprotractor_1   |     at doSend.then.response (/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    matchdciprotractor_1   |     at process._tickCallback (internal/process/next_tick.js:68:7)
    matchdciprotractor_1   | From: Task: WebDriver.switchTo().defaultContent()
    matchdciprotractor_1   |     at thenableWebDriverProxy.schedule (/protractor/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
    matchdciprotractor_1   |     at TargetLocator.defaultContent (/protractor/node_modules/selenium-webdriver/lib/webdriver.js:1798:25)
    matchdciprotractor_1   |     at Function.<anonymous> (/protractor/src/elements/utils.ts:112:38)
    matchdciprotractor_1   |     at step (/protractor/dist/src/elements/utils.js:44:23)
    matchdciprotractor_1   |     at Object.next (/protractor/dist/src/elements/utils.js:25:53)
    matchdciprotractor_1   |     at /protractor/dist/src/elements/utils.js:19:71
    matchdciprotractor_1   |     at new Promise (<anonymous>)
    matchdciprotractor_1   |     at __awaiter (/protractor/dist/src/elements/utils.js:15:12)
    matchdciprotractor_1   |     at Function.Utils.doSwitch (/protractor/dist/src/elements/utils.js:179:16)
    matchdciprotractor_1   |     at Function.<anonymous> (/protractor/src/elements/utils.ts:98:20) name: 'TimeoutError', remoteStacktrace: '' }
AMendis
  • 1,346
  • 4
  • 18
  • 34
  • can you give info like: how many tests you are running.. in parallel or .. stats from docker .. docker ps.. cpu/ram usage etc.. Normal this issue occurs when there is huge load and cannot render the page properly. – Infern0 Apr 24 '20 at 08:02
  • @Infern0 I'm running 20 test cases. they are not parrellel. This is my docker stats https://user-images.githubusercontent.com/34884192/80197536-9f929980-85d3-11ea-90e4-de4986b85b52.png – AMendis Apr 25 '20 at 13:43

3 Answers3

0

Try with following configuration. Mount the host folders to the container by your needs.

Each node is restricted to 1 browser. Also be sure to provide the proper capabilities from the test-framework. like: --disable-gpu --no-sandbox

Also you can experiment with --disable-dev-shm-usage

Dont forget to apply proper selenoid capabilities:

Example from typescript, you can addapt them to all programming lang.

'selenoid:options': {
                version: '81',
                enableVNC: false,
                enableVideo: false,
                enableLog: false, // save session logs
                videoScreenSize: '1920x1080',
                videoFrameRate: 24,
                videoCodec: 'mpeg4',
                screenResolution: '1920x1080x24'
            },

Docker-Compose:

version: '3'
services:
  selenoid:
    image: "aerokube/selenoid:1.9.2"
    container_name: selenoid
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - "./:/etc/selenoid/:ro"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./video/:/opt/selenoid/video/"
      - "./logs/:/opt/selenoid/logs/"
    environment:
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs", "-limit", "3", "-timeout", "5m"]
  selenoid-ui:
    image: "aerokube/selenoid-ui:1.8.0"
    container_name: selenoid-ui
    network_mode: bridge
    links:
      - selenoid
    ports:
      - "9090:9090"
    command: ["--selenoid-uri", "http://selenoid:4444", "--listen", ":9090"]

Browsers.json

{
    "chrome": {
        "default": "81",
        "versions": {
            "81": {
                "image": "selenoid/chrome:81.0",
                "env": [
                    "NODE_MAX_SESSION", "1",
                    "NODE_MAX_INSTANCES", "1",
                    "SCREEN_WIDTH", "1920",
                    "SCREEN_HEIGHT", "1080",
                    "SCREEN_DEPTH", "24",
                    "DBUS_SESSION_BUS_ADDRESS", "/dev/null"
                ],
                "port": "4444",
                "tmpfs": {
                    "/tmp": "size=512m"
                }
            },
            "81_vnc": {
                "image": "selenoid/vnc:chrome_81.0",
                "env": [
                    "NODE_MAX_SESSION", "1",
                    "NODE_MAX_INSTANCES", "1",
                    "SCREEN_WIDTH", "1920",
                    "SCREEN_HEIGHT", "1080",
                    "SCREEN_DEPTH", "24",
                    "DBUS_SESSION_BUS_ADDRESS", "/dev/null"
                ],
                "port": "4444",
                "tmpfs": {
                    "/tmp": "size=512m"
                }
            }
        }
    }
}
Infern0
  • 2,565
  • 1
  • 8
  • 21
0

Add SessionTimeout capability as the following example:

capabilities.setCapability("sessionTimeout","30m");

  • This will set timeOut to 30 minutes
  • Timeout is specified in Golang duration format, e.g. 30m or 10s or 1h5m
Yaron
  • 1,199
  • 1
  • 15
  • 35
0
capabilities.setCapability("sessionTimeout","30m");

This as in chrome capabilities

And can we handle this through session-attempt-timeout in docker when to use this

vimuth
  • 5,064
  • 33
  • 79
  • 116