aerokube/selenoid-ui

Show detailed error message when manual session can't start

TimurNurlygayanov opened this issue · 4 comments

Hi, I'm trying to start Android emulator in docker and my setup is the following:

Base OS: MacOS Catalina 10.15.7
Docker version 20.10.2, build 2291f61

browser.json:

{
  "android": {
    "default": "10.0",
    "versions": {
      "10.0": {
        "image": "selenoid/android:10.0",
        "port": "4444",
        "path": "/wd/hub",
        "selenoid:options": {
          "enableVNC": true,
          "enableVideo": true
        }
      }
    }
  }
}

docker-compose.yml:

version: '3'
services:
  selenoid:
    image: "aerokube/selenoid"
    network_mode: bridge
    ports:
      - "4444:4444"
    volumes:
      - "$PWD/config:/etc/selenoid/" # assumed current dir contains browsers.json
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "$PWD/video:/opt/selenoid/video"
      - "$PWD/logs:/opt/selenoid/logs"
    environment:
      - OVERRIDE_VIDEO_OUTPUT_DIR=$PWD/video
    command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
  selenoid-ui:
    image: "aerokube/selenoid-ui"
    network_mode: bridge
    links:
      - selenoid
    ports:
      - "8080:8080"
    command: ["--selenoid-uri", "http://selenoid:4444"]

So, when I open SelenoidUI at http://localhost:8080/#/capabilities/ and click "Create Session", the request fails with the error:

POST http://localhost:8080/wd/hub/session
status code 500 Internal Server Error
Response Body:
{"status":13,"value":{"message":"wait: http://172.17.0.4:4444/wd/hub does not respond in 30s"}}

More info:

docker ps -a
CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS                    PORTS                    NAMES
a823c23ffd9d   aerokube/selenoid-ui   "/selenoid-ui --sele…"   34 minutes ago   Up 34 minutes (healthy)   0.0.0.0:8080->8080/tcp   selenoid-android_selenoid-ui_1
9a0f732951c1   aerokube/selenoid      "/usr/bin/selenoid -…"   34 minutes ago   Up 34 minutes             0.0.0.0:4444->4444/tcp   selenoid-android_selenoid_1
 docker image list -a
REPOSITORY             TAG              IMAGE ID       CREATED         SIZE
aerokube/selenoid      latest           c0ab90eb2ac0   2 weeks ago     16.8MB
aerokube/selenoid      latest-release   c0ab90eb2ac0   2 weeks ago     16.8MB
aerokube/selenoid-ui   latest           800e1f3d15fa   4 weeks ago     17.5MB
selenoid/android       10.0             78cbc1c22916   4 months ago    9.33GB
selenoid/android       7.0              0acd62321707   4 months ago    7.09GB

selenoid logs:

docker logs 9875f35a5a41
2021/02/04 17:51:44 [-] [INIT] [Loading configuration files...]
2021/02/04 17:51:44 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
2021/02/04 17:51:44 [-] [INIT] [Video Dir: /opt/selenoid/video]
2021/02/04 17:51:44 [-] [INIT] [Logs Dir: /opt/selenoid/logs]
2021/02/04 17:51:44 [-] [INIT] [Your Docker API version is 1.41]
2021/02/04 17:51:44 [-] [INIT] [Timezone: UTC]
2021/02/04 17:51:44 [-] [INIT] [Listening on :4444]
2021/02/04 17:51:58 [-] [NEW_REQUEST] [unknown] [172.17.0.1]
2021/02/04 17:51:58 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.1]
2021/02/04 17:51:58 [3] [LOCATING_SERVICE] [android] [10.0]
2021/02/04 17:51:58 [3] [USING_DOCKER] [android] [10.0]
2021/02/04 17:51:58 [3] [CREATING_CONTAINER] [selenoid/android:10.0]
2021/02/04 17:51:58 [3] [STARTING_CONTAINER] [selenoid/android:10.0] [142d98e040eb00a7c572bfd9de19cb66eebf2b2753259942ccfc17976cd32bc4]
2021/02/04 17:51:58 [3] [CONTAINER_STARTED] [selenoid/android:10.0] [142d98e040eb00a7c572bfd9de19cb66eebf2b2753259942ccfc17976cd32bc4] [0.29s]
2021/02/04 17:52:28 [3] [REMOVING_CONTAINER] [142d98e040eb00a7c572bfd9de19cb66eebf2b2753259942ccfc17976cd32bc4]
2021/02/04 17:52:28 [3] [CONTAINER_REMOVED] [142d98e040eb00a7c572bfd9de19cb66eebf2b2753259942ccfc17976cd32bc4]
2021/02/04 17:52:28 [3] [SERVICE_STARTUP_FAILED] [wait: http://172.17.0.4:4444/wd/hub does not respond in 30s]

What am I doing wrong?

Update:
I've tried to add option

-service-startup-timeout 2m

But it didn't help, the error now is the same:

wait: http://172.17.0.4:4444/wd/hub does not respond in 2m0s

Ok we can close the issue, I've found the following error in android docker container:

emulator: ERROR: x86 emulation currently requires hardware acceleration!
CPU acceleration status: KVM requires a CPU that supports vmx or svm

adb: no devices/emulators found
adb: no devices/emulators found
adb: no devices/emulators found
adb: no devices/emulators found

It looks like my configuration doesn't support hardware acceleration for the emulator.

@TimurNurlygayanov Android images will not work under Mac because Docker for Mac does not forward KVM capabilities of the CPU.

@vania-pooh I noticed that SelenoidUI doesn't show any errors in case solenoid can't start the session, and the user has to check the dev console to see the error message from the backend. Maybe we can improve UX and add some information about error messages to Selenoid WebUI? (so it is not urgent)