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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Chrome docker tags 124.0 / 4.20 SessionNotCreatedException #2225

Open
kisuro opened this issue Apr 25, 2024 · 11 comments
Open

Comments

@kisuro
Copy link

kisuro commented Apr 25, 2024

What happened?

I use selenium as a service in gitlab-ci.yml (selenium/standalone-chrome:latest)
Before the current update this morning, everything was fine.
However, after tag updates to 4.20 and 124 this morning, I started getting an error on all environments

Tried updating selenium to 4.20,
tried tags :
selenium/standalone-chrome:124.0
selenium/standalone-chrome:latest
selenium/standalone-chrome:4.20
All of these options return the Message: Failed to start a new session

When setting tag 123.0 (selenium/standalone-chrome:123.0) everything works correctly.

Command used to start Selenium Grid with Docker (or Kubernetes)

m_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '5'

Relevant log output

E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
209E       Host info: host: '23ef3a12361a', ip: '172.20.0.2'
210E       Build info: version: '4.20.0', revision: '866c76ca80'
211E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
212E       Driver info: driver.version: unknown
213E       Stacktrace:
214E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
215E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
216E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
217E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
218E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
219E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
220E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
221E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
222E           at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
223E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
224E           at java.lang.Thread.run (None:-1)
225/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException
226

Operating System

Linux

Docker Selenium version (image tag)

latest

Selenium Grid chart version (chart version)

No response

Copy link

@kisuro, 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!

@VietND96
Copy link
Member

Can you provide the test to reproduce and what binding version is used? Since our CI tests not seen this failure

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

Can you provide the test to reproduce and what binding version is used? Since our CI tests not seen this failure

docker:20.10.12-dind

I use pytest for tests, with fixtures, objects, etc, but the problem is that all 100 tests crashed with this error without even starting, the browser was not initialised.
Even the simplest test to open any page causes this problem.

Also tried a local run with selenium 4.20 on Chrome 124.0 - all runs successfully.

@VietND96
Copy link
Member

I guess there is lib using HTTP/1.1 and it isn't compatible to be proceeded by selenium as the message java.io.IOException: HTTP/1.1 header parser received no bytes

@VietND96
Copy link
Member

@diemol, this case is Python binding. Do you have any idea how to troubleshoot?

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

example simple test:

import pytest

from framework.application import Application

@pytest.mark.selenium
def test_selenium(app: Application):
    app.wd.get('https://www.google.com')

error log (selenium/standalone-chrome:latest):

ERROR test/mobile/test_selenium.py::test_selenium - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
Host info: host: '5e6c8b61ce37', ip: '172.20.0.2'
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
    at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
    at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
    at java.lang.Thread.run (None:-1)

successful log (just updated tag: selenium/standalone-chrome:123.0):

platform linux -- Python 3.10.2, pytest-8.1.1, pluggy-1.5.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: n
configfile: pytest.ini
plugins: xdist-3.5.0, rerunfailures-14.0, jira-xray-0.8.11, jira-0.3.20, dependency-0.6.0, allure-pytest-2.13.5, bdd-5.0.0
collecting ... collected 156 items / 1[55] deselected / 1 selected
test/mobile/test_selenium.py::test_selenium 
-------------------------------- live log setup --------------------------------
2024-04-25 10:51:11 [    INFO] REMOTE MODE: FLAG DEVICE EMULATION:False (application.py:85)
2024-04-25 10:51:11 [    INFO] BROWSER:chrome VER:123.0.6312.86 (application.py:90)
2024-04-25 10:51:11 [    INFO] Browser TimeZone set to: Europe/Berlin (application.py:92)
PASSED                                                                   [100%]
    

@diemol
Copy link
Member

diemol commented Apr 25, 2024

What version of Selenium Python?

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

What version of Selenium Python?

now updated to 4.20.0, was 4.19.0 .
For both same result for tag 'latest' - error

@VietND96
Copy link
Member

VietND96 commented May 6, 2024

@kisuro, can you try to start the container with set SE_LOG_LEVEL=FINE to see more details for reason Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes
Also, at client binding, in the method app.wd.get(), is there any capabilities set related to the browser version or driver path there?

@kisuro
Copy link
Author

kisuro commented May 8, 2024

@kisuro, can you try to start the container with set SE_LOG_LEVEL=FINE to see more details for reason Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes Also, at client binding, in the method app.wd.get(), is there any capabilities set related to the browser version or driver path there?

pre:

  • added to gitlab-ci.yml log level variable (hope its correct, because I doesnt see any new details in log)
marked_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '8'
        SE_LOG_LEVEL: 'FINE'

Result log:
selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes
Host info: host: '2f7cc90ad43a', ip: '172.0.0.0'
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Stacktrace:
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
at java.lang.Thread.run (None:-1)

  1. Options for remote chrome driver in app:
    def _chrome_options(browser_mode: str, device_emulation: bool) -> Options:
        opt = Options()
        opt.add_argument("--no-sandbox")
        opt.add_argument("--incognito")
        opt.add_argument("--verbose")
        opt.add_argument("--ignore-certificate-errors")
        opt.add_argument("--start-maximized")
        opt.add_experimental_option("excludeSwitches", ["enable-automation"])
        opt.add_experimental_option("useAutomationExtension", False)
        opt.add_argument("--allow-running-insecure-content")
        opt.add_argument("--disable-dev-shm-usage")
        opt.add_experimental_option('prefs', {
            "download.default_directory": pytest.root_dir,  # Change default directory for downloads
            "download.prompt_for_download": False,  # To auto download the file
            "download.directory_upgrade": True,
            "plugins.always_open_pdf_externally": True  # It will not show PDF directly in chrome
        })
        opt.page_load_strategy = "normal"

        if device_emulation:
            opt.add_experimental_option("mobileEmulation", mobile_emulation)
        else:
            opt.add_argument("--window-size=1920,1080")

        if browser_mode != "normal":
            opt.add_argument("--headless")

        return opt
 remote_url = f"http://{browser}:4444"      
 wd_remote = webdriver.Remote(remote_url, options=self._chrome_options(browser_mode, device_emulation))

@VietND96
Copy link
Member

@kisuro, is this issue able to reproduce with the recent latest or chrome 125.0 image tag?
If yes, can you provide which version of Docker engine, docker-compose that you are using?

@VietND96 VietND96 added this to the 4.22 milestone May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants