Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome and edge sessions are not created #419

Open
gaarutyunov opened this issue Apr 11, 2024 · 3 comments
Open

Chrome and edge sessions are not created #419

gaarutyunov opened this issue Apr 11, 2024 · 3 comments

Comments

@gaarutyunov
Copy link

Chrome browser container logs:

Starting ChromeDriver 123.0.6312.86 (9b72c47a053648d405376c5cf07999ed626728da-refs/branch-heads/6312@{#698}) on port 4444
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1712828795.840][SEVERE]: bind() failed: Cannot assign requested address (99)
ChromeDriver was started successfully.

kubectl describe output:

Name:                      chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc
Namespace:                 moon
Priority:                  0
Node:                      tenderhub-k8s-dev-worker-26/172.16.20.45
Start Time:                Thu, 11 Apr 2024 13:22:17 +0400
Labels:                    browserName=chrome
                           browserVersion=123.0.6312.105-6
                           enableVNC=true
                           enableVideo=false
                           moon=browser
                           moon.aerokube.com/framework=SE
                           quota=moon
                           screenResolution=1920x1080
Annotations:               cni.projectcalico.org/podIP: 
                           cni.projectcalico.org/podIPs: 
                           moon.aerokube.com/quota: moon
Status:                    Terminating (lasts <invalid>)
Termination Grace Period:  30s
IP:                        10.244.144.69
IPs:
  IP:  10.244.144.69
Init Containers:
  ca-certs:
    Container ID:  docker://21e07e5f4dcd7de9abe2fd03b3a3cd7665ec6ad790ed6f701e94a17506550049
    Image:         quay.io/aerokube/ca-certs:2.6.4
    Image ID:      docker-pullable://quay.io/aerokube/ca-certs@sha256:27fd14946779eed5c1787c4f497f27afe66b92e425f79626ffac32592492c216
    Port:          <none>
    Host Port:     <none>
    Command:
      sh
      -c
      cat /etc/ssl/certs/ca-certificates.crt /certs/ca >/tmp/ca-certificates.crt
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 11 Apr 2024 13:22:18 +0400
      Finished:     Thu, 11 Apr 2024 13:22:18 +0400
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     200m
      memory:  32Mi
    Requests:
      cpu:        100m
      memory:     32Mi
    Environment:  <none>
    Mounts:
      /certs/ca from usergroup (rw,path="ca")
      /tmp from ca-certs (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fwksz (ro)
Containers:
  browser:
    Container ID:   docker://8b6b9679eae82a60178ac581eb26dc8fc89e3215982c35f0febe762b67a9ecbb
    Image:          quay.io/browser/google-chrome-stable:123.0.6312.105-6
    Image ID:       docker-pullable://quay.io/browser/google-chrome-stable@sha256:0621cd3f522843033fdf10cf88d378aa37898bc0fbf2270020506ec7040a29cb
    Port:           4444/TCP
    Host Port:      0/TCP
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 11 Apr 2024 13:22:19 +0400
      Finished:     Thu, 11 Apr 2024 13:22:22 +0400
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  2Gi
    Requests:
      cpu:     500m
      memory:  2Gi
    Environment:
      DISPLAY:  127.0.0.1:0
    Mounts:
      /dev/shm from dshm (rw)
      /etc/group from usergroup (rw,path="group")
      /etc/passwd from usergroup (rw,path="passwd")
      /etc/ssl/certs from ca-certs (rw)
      /home/user from home (rw)
      /home/user/Downloads from downloads (rw)
      /tmp from tmp (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fwksz (ro)
  defender:
    Container ID:  docker://d42f881141e01bf0d751db6bba721364278ad02ad9e7e6b1b70456be8cf27bc3
    Image:         quay.io/aerokube/defender:2.6.4
    Image ID:      docker-pullable://quay.io/aerokube/defender@sha256:93b7a571569ca2f500165ee45a37870c7de5fa79a6d0557bfdc98b58b2d6a351
    Port:          4545/TCP
    Host Port:     0/TCP
    Args:
      -moon-url
      http://moon.moon:4444/wd/hub
      -session-timeout
      5m
      -quota
      moon
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 11 Apr 2024 13:22:19 +0400
      Finished:     Thu, 11 Apr 2024 13:22:22 +0400
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     250m
      memory:  128Mi
    Requests:
      cpu:     100m
      memory:  128Mi
    Environment:
      DISPLAY:  127.0.0.1:0
    Mounts:
      /dev/shm from dshm (rw)
      /etc/group from usergroup (rw,path="group")
      /etc/passwd from usergroup (rw,path="passwd")
      /etc/ssl/certs from ca-certs (rw)
      /home/user from home (rw)
      /home/user/Downloads from downloads (rw)
      /tmp from tmp (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fwksz (ro)
  x-server:
    Container ID:   docker://8251b6ee14c73e7569e7b6108464cf868afd56dbf136c0312b0a26b062c59470
    Image:          quay.io/aerokube/xvfb-server:2.6.4
    Image ID:       docker-pullable://quay.io/aerokube/xvfb-server@sha256:29286edf4ab2af4512f52c25708099469bac1cdf44d70df47654fe3f36ae61cd
    Port:           6000/TCP
    Host Port:      0/TCP
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 11 Apr 2024 13:22:20 +0400
      Finished:     Thu, 11 Apr 2024 13:22:22 +0400
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     200m
      memory:  128Mi
    Requests:
      cpu:     100m
      memory:  128Mi
    Environment:
      SCREEN_RESOLUTION:  1920x1080
    Mounts:
      /dev/shm from dshm (rw)
      /etc/group from usergroup (rw,path="group")
      /etc/passwd from usergroup (rw,path="passwd")
      /etc/ssl/certs from ca-certs (rw)
      /home/user from home (rw)
      /home/user/Downloads from downloads (rw)
      /tmp from tmp (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fwksz (ro)
  vnc-server:
    Container ID:   docker://2616f5c363e1b0969033c570aaa0b1580fe7a668be1f4f6227a19e035c0a81fc
    Image:          quay.io/aerokube/vnc-server:2.6.4
    Image ID:       docker-pullable://quay.io/aerokube/vnc-server@sha256:0344af2af8e13b491d1b173a7434943fbd80bbf558cfe872ebad7dfdb15f19d1
    Port:           5900/TCP
    Host Port:      0/TCP
    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 11 Apr 2024 13:22:20 +0400
      Finished:     Thu, 11 Apr 2024 13:22:22 +0400
    Ready:          False
    Restart Count:  0
    Limits:
      cpu:     200m
      memory:  128Mi
    Requests:
      cpu:     100m
      memory:  128Mi
    Environment:
      DISPLAY:  127.0.0.1:0
    Mounts:
      /dev/shm from dshm (rw)
      /etc/group from usergroup (rw,path="group")
      /etc/passwd from usergroup (rw,path="passwd")
      /etc/ssl/certs from ca-certs (rw)
      /home/user from home (rw)
      /home/user/Downloads from downloads (rw)
      /tmp from tmp (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fwksz (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  dshm:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     Memory
    SizeLimit:  <unset>
  usergroup:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc
    Optional:  false
  tmp:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     Memory
    SizeLimit:  <unset>
  home:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     Memory
    SizeLimit:  <unset>
  downloads:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  <unset>
  ca-certs:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     Memory
    SizeLimit:  <unset>
  default-token-fwksz:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-fwksz
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  selector=test
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason       Age               From               Message
  ----     ------       ----              ----               -------
  Normal   Scheduled    13s               default-scheduler  Successfully assigned moon/chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc to tenderhub-k8s-dev-worker-26
  Normal   Pulled       12s               kubelet            Container image "quay.io/aerokube/ca-certs:2.6.4" already present on machine
  Normal   Created      12s               kubelet            Created container ca-certs
  Normal   Started      11s               kubelet            Started container ca-certs
  Normal   Pulled       11s               kubelet            Container image "quay.io/browser/google-chrome-stable:123.0.6312.105-6" already present on machine
  Normal   Created      11s               kubelet            Created container browser
  Normal   Started      11s               kubelet            Started container browser
  Normal   Pulled       11s               kubelet            Container image "quay.io/aerokube/defender:2.6.4" already present on machine
  Normal   Created      11s               kubelet            Created container defender
  Normal   Started      11s               kubelet            Started container defender
  Normal   Pulled       11s               kubelet            Container image "quay.io/aerokube/xvfb-server:2.6.4" already present on machine
  Normal   Created      11s               kubelet            Created container x-server
  Normal   Started      10s               kubelet            Started container x-server
  Normal   Pulled       10s               kubelet            Container image "quay.io/aerokube/vnc-server:2.6.4" already present on machine
  Normal   Created      10s               kubelet            Created container vnc-server
  Normal   Started      10s               kubelet            Started container vnc-server
  Warning  FailedMount  8s (x3 over 10s)  kubelet            MountVolume.SetUp failed for volume "usergroup" : configmap "chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc" not found
  Normal   Killing      8s                kubelet            Stopping container browser
  Normal   Killing      8s                kubelet            Stopping container x-server
  Normal   Killing      8s                kubelet            Stopping container vnc-server
  Normal   Killing      8s                kubelet            Stopping container defender
  Warning  FailedMount  6s                kubelet            MountVolume.SetUp failed for volume "usergroup" : object "moon"/"chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc" not registered

moon container logs:

2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: starting new session
2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: creating config map
2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: config map created
2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: creating pod
2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: pod created
2024/04/11 09:22:17 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: waiting pod
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: pod is up
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: waiting driver
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: driver is up
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: session failed: driver response code: 500: Internal Server Error
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: deleting pod
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: pod deleted
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: deleting config map
2024/04/11 09:22:20 moon-75db65fc64-bql2k: moon: chrome-123-0-6312-105-6-803d6b40-726b-4b8f-8275-bc8038ae4fcc: config map deleted

Selenium output:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
E         (session not created: DevToolsActivePort file doesn't exist)
E         (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

I've tried all combinations of the following arguments (even without double dash prefix):

options = webdriver.ChromeOptions()
options.add_experimental_option("w3c", True)
options.arguments.extend(
    [
        "--remote-debugging-port=9222",
        "--no-sandbox",
        "--disable-dev-shm-usage",
    ]
)

Also have tried to add --headless and --headless=new.

It does work for Opera, tho doesn't for chrome and edge. Safari and Firefox work fine (they are no chromium based, but just adding fyi).

@vania-pooh
Copy link
Member

@gaarutyunov what kind of architecture is being used for Kubernetes nodes? If you are running under Minikube on Mac, are you using M1 Mac?

@gaarutyunov
Copy link
Author

gaarutyunov commented Apr 11, 2024

@vania-pooh
Linux CentOS 7.8
Kubernetes 1.20.9
The node used for tests is 5.1 CCU, 64 GiB RAM (8 CPU ✕ 5.13 CCU) with a 64 GB SSD volume

@vania-pooh
Copy link
Member

@gaarutyunov in CentOS this should be related to permission restrictions added to processes in containers by CentOS kernel. E.g. this could be related to SELinux or another security setting. Also you don't need to set this flag "--remote-debugging-port=9222" because Chromedriver will set its own value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants