docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🐛 Bug]: selenium/node-chrome 118 Intermittent "Could not start a new session"

Open Wolfe1 opened this issue 3 years ago • 8 comments

What happened?

We have tests running across multiple different products, after the update to selenium/node-chrome:118.0-20231016 we started seeing tests periodically failing to generate a new session (error in log output section).

Reverting back to selenium/node-chrome:117.0 has so far eliminated the issue. I am not sure if this is an issue with the docker image or chrome 118 but figured I would report here in case anyone else was experiencing the issue.

Command used to start Selenium Grid with Docker

apiVersion: apps/v1
kind: Deployment
metadata:
  name: selenium-chrome-node-deployment
  namespace: selenium-grid
  uid: d236c64c-f284-4b3c-8a1c-670ef36c1788
  resourceVersion: '309331134'
  generation: 115596
  creationTimestamp: '2022-07-01T18:59:18Z'
  labels:
    app: selenium-node-chrome
  annotations:
    deployment.kubernetes.io/revision: '42'
  selfLink: >-
    /apis/apps/v1/namespaces/legion-selenium-grid/deployments/selenium-chrome-node-deployment
status:
  observedGeneration: 115596
  replicas: 37
  updatedReplicas: 37
  readyReplicas: 37
  availableReplicas: 37
  conditions:
    - type: Progressing
      status: 'True'
      lastUpdateTime: '2023-10-19T13:22:02Z'
      lastTransitionTime: '2022-07-01T18:59:18Z'
      reason: NewReplicaSetAvailable
      message: >-
        ReplicaSet "selenium-chrome-node-deployment-5db84db97b" has successfully
        progressed.
    - type: Available
      status: 'True'
      lastUpdateTime: '2023-10-19T14:38:24Z'
      lastTransitionTime: '2023-10-19T14:38:24Z'
      reason: MinimumReplicasAvailable
      message: Deployment has minimum availability.
spec:
  replicas: 37
  selector:
    matchLabels:
      app: selenium-node-chrome
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: selenium-node-chrome
    spec:
      volumes:
        - name: dshm
          emptyDir:
            medium: Memory
        - name: downloads
          persistentVolumeClaim:
            claimName: selenium-grid-downloads
      containers:
        - name: selenium-node-chrome
          image: selenium/node-chrome:latest
          ports:
            - containerPort: 5555
              protocol: TCP
          env:
            - name: SE_EVENT_BUS_HOST
              value: selenium-grid
            - name: SE_NODE_GRID_URL
              value: http://selenium-grid:4444
            - name: SE_NODE_PORT
              value: '5555'
            - name: SE_EVENT_BUS_SUBSCRIBE_PORT
              value: '4443'
            - name: SE_EVENT_BUS_PUBLISH_PORT
              value: '4442'
            - name: SCREEN_WIDTH
              value: '1920'
            - name: SCREEN_HEIGHT
              value: '1080'
            - name: VNC_NO_PASSWORD
              value: '1'
            - name: TZ
              value: US/Central
            - name: SE_NODE_SESSION_TIMEOUT
              value: '1800'
          resources:
            requests:
              cpu: 450m
              memory: 1000Mi
          volumeMounts:
            - name: dshm
              mountPath: /dev/shm
            - name: downloads
              mountPath: /home/seluser/Downloads
          lifecycle:
            preStop:
              exec:
                command:
                  - /bin/sh
                  - '-c'
                  - >-
                    curl --request POST 'localhost:5555/se/grid/node/drain'
                    --header 'X-REGISTRATION-SECRET;'; tail --pid=$(pgrep -f
                    '[n]ode --bind-host false --config
                    /opt/selenium/config.toml') -f /dev/null; sleep 30s
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 7200
      dnsPolicy: ClusterFirst
      nodeSelector:
        agentpool: user
      securityContext: {}
      schedulerName: default-scheduler
      dnsConfig: {}
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 25%
  minReadySeconds: 5
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 900

Relevant log output

SessionNotCreatedException: Message: Could not start a new session. Could not start a new session. Unable to obtain: Capabilities {browserName: chrome, browserVersion: 118.0, goog:chromeOptions: {args: [--disable-popup-blocking, --use-fake-ui-for-media-stream, --use-fake-device-for-media...], extensions: [], prefs: {browser.disable-popup-blocking: {True}, browser.download.dir: ~/Downloads, browser.download.directory_upgrade: true, browser.download.prompt_for_download: false}}, pageLoadStrategy: normal, platformName: linux, se:name: TEST_NAME_HERE..., se:noVncPort: 7900, se:vncEnabled: true}, error Failed to parse json output, executed: [--browser, chrome, --output, json, --browser-version, 118.0]

Build info: version: '4.14.1', revision: '03f8ede370'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1042-azure', java.version: '11.0.20.1'
Driver info: driver.version: unknown 
Host info: host: 'selenium-chrome-node-deployment-7dd758577c-nh5xt', ip: '10.196.169.189'
Build info: version: '4.14.1', revision: '03f8ede370'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1042-azure', java.version: '11.0.20.1'
    [ Message content over the limit has been removed. ]
Build info: version: '4.14.1', revision: '03f8ede370'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1042-azure', java.version: '11.0.20.1'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.grid.node.remote.RemoteNode.newSession (RemoteNode.java:151)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:644)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:563)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:823)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:783)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:829)

Operating System

Linux

Docker Selenium version (tag)

selenium/node-chrome=118.0-20231016, selenium/hub=4.14.1

Wolfe1 avatar Oct 19 '23 20:10 Wolfe1

@Wolfe1, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Oct 19 '23 20:10 github-actions[bot]

Also seeing strange behaviour with selenium/node-chrome:118 and selenium/hub:4.14 where timeouts on expected condition waits don't ever timeout, cpu usage goes very high and then subsequently I get the same errors as logged above as there's no free slots for new tests.

Rolling back to 117 and 4.13 resolves it straight away.

alexharrington avatar Oct 22 '23 14:10 alexharrington

In other issues, people are also reporting problems with Chrome 118. Can you find a way to reproduce it so it can be reported to Google?

diemol avatar Oct 22 '23 20:10 diemol

Hi, @Wolfe1. This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team. Feel free to comment the issues that you raise back in this issue. Thank you.

github-actions[bot] avatar Oct 24 '23 12:10 github-actions[bot]

Please report this to Google, a test that works with Chrome 117 but fails with Chrome 118 is enough.

diemol avatar Oct 24 '23 12:10 diemol

I question if this is truly a chromedriver issue. We ran into the issue noted in this post with Chrome after upgrading our selenium-grid environment in the following manner:

Old configuration:

  • chrome: selenium/node-chrome:117.0

  • hub: selenium/hub:4.14

  • firefox: selenium/node-firefox:118.0 (this comes in later)

    In this state, Firefox and Chrome were working as expected for our run of about ~4900 tests

New configuration:

  • chrome: selenium/node-chrome:118.0

  • hub: selenium/hub:4.14

  • firefox: selenium/node-firefox:118.0

    In this state, Chrome reported the SessionNotCreatedException for 87 of the ~2200 Chrome tests

Based on what was noted on this thread, we changed our setup to:

  • chrome: selenium/node-chrome:117.0

  • hub: selenium/hub:4.13

  • firefox: selenium/node-firefox:118.0

    In this state, Chrome was fine but Firefox returned the SessionNotCreatedException for 12 of the ~2200 Firefox tests:

    selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Could not start a 
    new session. Unable to obtain: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 118.0, 
    moz:debuggerAddress: true, moz:firefoxOptions: {prefs: {widget.gtk.overlay-scrollbars.enabled: false}}, 
    nodename:applicationName: nightly, pageLoadStrategy: normal, platformName: linux, se:noVncPort: 7900, 
    se:vncEnabled: true}, error Failed to parse json output, executed: [--browser, firefox, --output, json, --browser-version, 
    118.0]
    
    Build info: version: '4.14.1', revision: '03f8ede370'
    System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-87-generic', java.version: '11.0.20.1'
    Driver info: driver.version: unknown 
    Host info: host: '5e757fccdc1e', ip: '172.21.0.14'
    Build info: version: '4.14.1', revision: '03f8ede370'
    System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-87-generic', java.version: '11.0.20.1'
    Driver info: driver.version: unknown
    Build info: version: '4.13.0', revision: 'ba948ece5b*'
    System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-87-generic', java.version: '11.0.20.1'
    Driver info: driver.version: unknown
    Stacktrace:
        at org.openqa.selenium.grid.node.remote.RemoteNode.newSession (RemoteNode.java:151)
        at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:648)
        at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:565)
        at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:829)
        at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:787)
        at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
     at java.lang.Thread.run (Thread.java:829)
    

All this being said, the fact that changing selenium/hub from 4.13 -> 4.14 fixes Firefox having the same issue reported here leads me to believe that there is a conflict between what the hub is doing and what the browser container is doing which is outside realm of the chromedriver project.

garth-gross avatar Oct 25 '23 16:10 garth-gross

I can confirm the issue exists from DOCKER 118 and above. Right now downgraded to 117 waiting for the issue to be fix.

soul3510 avatar Nov 20 '23 11:11 soul3510

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 21 '23 00:12 github-actions[bot]