seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
249 stars 26 forks source link

[🐛 Bug]: Session unable to start for Selenium 4.11.0 due to permission error #46

Closed jamesmortensen closed 8 months ago

jamesmortensen commented 1 year ago

What happened?

In the logs, we can see tests failing when attempting to test Seleniarm images using Selenium 4.11.0. The full logs can be found here:

https://app.circleci.com/pipelines/github/seleniumhq-community/docker-seleniarm/368/workflows/bcace299-db41-4695-8f7c-cfc374605b2a/jobs/1398

The part that sticks out to me is the complaints about permission issues and unexpected word:

selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Could not start a new session. Unable to obtain: Capabilities {browserName: chrome, browserVersion: 116.0, goog:chromeOptions: {args: [], extensions: []}, pageLoadStrategy: normal, se:noVncPort: 7900, se:vncEnabled: true}, error Command failed with code: 2, executed: [/tmp/selenium-manager67305284127211587224812580076201/selenium-manager, --browser, chrome, --output, json, --browser-version, 116.0]
/tmp/selenium-manager67305284127211587224812580076201/selenium-manager: 1: cannot create �@8jL@8: Permission denied
/tmp/selenium-manager67305284127211587224812580076201/selenium-manager: 2: Syntax error: word unexpected (expecting ")")

Command used to start Selenium Grid with Docker

# This is taken from the circleci workflow config file:
USE_RANDOM_USER_ID=false NAMESPACE=seleniarm VERSION=4.11.0 BUILD_DATE=now SKIP_BUILD=true make test_multi_arch

Relevant log output

======================================================================
ERROR: test_title (SeleniumTests.ChromeTests.test_title)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/circleci/project/tests/SeleniumTests/__init__.py", line 71, in setUp
    self.driver = webdriver.Remote(
                  ^^^^^^^^^^^^^^^^^
  File "/opt/circleci/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in __init__
    self.start_session(capabilities, browser_profile)
  File "/opt/circleci/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/circleci/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/opt/circleci/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Could not start a new session. Unable to obtain: Capabilities {browserName: chrome, browserVersion: 116.0, goog:chromeOptions: {args: [], extensions: []}, pageLoadStrategy: normal, se:noVncPort: 7900, se:vncEnabled: true}, error Command failed with code: 2, executed: [/tmp/selenium-manager67305284127211587224812580076201/selenium-manager, --browser, chrome, --output, json, --browser-version, 116.0]
/tmp/selenium-manager67305284127211587224812580076201/selenium-manager: 1: cannot create �@8jL@8: Permission denied
/tmp/selenium-manager67305284127211587224812580076201/selenium-manager: 2: Syntax error: word unexpected (expecting ")")

Host info: host: '93c3760a8c5e', ip: '172.18.0.3'
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '5.15.0-1039-aws', java.version: '11.0.20'
Driver info: driver.version: unknown
Build info: version: '4.11.0', revision: '040bc5406b'
System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '5.15.0-1039-aws', java.version: '11.0.20'
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:785)
    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

Ubuntu 20.04

Docker Selenium version (tag)

unreleased in CI only

jamesmortensen commented 1 year ago

I took a moment to document the issue preventing moving forward to Selenium 4.11.0. I am in the process of moving back to the USA, so if there's anyone who would like to help with this issue, that would be awesome!

github-actions[bot] commented 1 year ago

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

diemol commented 1 year ago

There is a permissions issue in 4.11.0 when using Selenium Manager in Linux. This is solved for 4.12.0.

However, I disabled Selenium Manager for Docker Selenium: https://github.com/SeleniumHQ/docker-selenium/commit/b5cec1c8de56823a8fbb227cfc048882bc12238e. Maybe you can do the same?

mgm248 commented 1 year ago

I'm not sure if this is related, but wanted to let you know I had problems using the latest seleniarm-chromium image since the update a couple days ago. Specifically, when I ran a driver.get('https://google.com'), I would get the error message: selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed from unknown error: web view not found Once I reverted to a previous version (standalone-chromium:4.10.0-20230615), things worked again. Running on Linux too.

jamesmortensen commented 1 year ago

Hi @diemol I brought in your commit that puts SM into offline mode https://github.com/seleniumhq-community/docker-seleniarm/commit/b5cec1c8de56823a8fbb227cfc048882bc12238e and I've updated to Selenium 4.12.1. The tests are still failing https://app.circleci.com/pipelines/github/seleniumhq-community/docker-seleniarm/373/workflows/4b1a759e-7831-4858-9d3c-765a5e8dc723/jobs/1438

Did the names of the browsers change from chrome to google-chrome? I also still see this in the stack trace:

/tmp/selenium-manager1020021369244423436900371086586/selenium-manager: 1: Syntax error: "(" unexpected

Please let me know if you might know what this is about. Thank you!

jamesmortensen commented 11 months ago

Just made an attempt to run a quick test using Selenium 4.12.1 and Chromium. Here's what I get:

SessionNotCreatedError: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/seluser/.cache/selenium/chrome/linux64/117.0.5938.92/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 
Host info: host: '25701f0ba98d', ip: '172.17.0.2'
Build info: version: '4.12.1', revision: '8e34639b11'
System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '5.10.0-9-arm64', java.version: '11.0.20'
Driver info: driver.version: unknown
Build info: version: '4.12.1', revision: '8e34639b11'
System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '5.10.0-9-arm64', java.version: '11.0.20'
Driver info: driver.version: unknown
    at Object.throwDecodedError (/Users/james/Dev/debug-tools-for-docker-selenium/selenium-webdriver-demo-javascript/node_modules/selenium-webdriver/lib/error.js:524:15)
    at parseHttpResponse (/Users/james/Dev/debug-tools-for-docker-selenium/selenium-webdriver-demo-javascript/node_modules/selenium-webdriver/lib/http.js:587:13)
    at Executor.execute (/Users/james/Dev/debug-tools-for-docker-selenium/selenium-webdriver-demo-javascript/node_modules/selenium-webdriver/lib/http.js:515:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  remoteStacktrace: ''
}

It looks like the system is trying to use Chrome for Testing, as it's looking for the Chrome binary inside the /home/seluser folder. Instead, it should be looking for Chromium at /usr/bin/chromium. If I can fix this, or if someone knows what might be happening here, we can perhaps get docker-seleniarm up and running fully again on the latest Selenium version.

I'm in the middle of a major life change and am the only maintainer, so I appreciate everyone's patience and appreciate any help others can bring to the table.

jamesmortensen commented 8 months ago

Fixed by #55 Thanks for the assist @fhoeben and @diemol

github-actions[bot] commented 7 months ago

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.