SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.87k stars 2.51k forks source link

[šŸ› Bug]: selenium.NoSuchSessionException: Unable to find session with ID #2135

Open YaronMordAnaplan opened 6 months ago

YaronMordAnaplan commented 6 months ago

What happened?

In the middle of the test, the connection with the selenium hub lost and It happens once a day

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

global:
  seleniumGrid:
    # Image registry for all selenium components
    imageRegistry: selenium
    logLevel: INFO

components:
  extraEnvironmentVariables:
    - name: SE_SESSION_REQUEST_TIMEOUT
      value: "7200"
    - name: SE_SESSION_RETRY_INTERVAL
      value: "3" 

chromeNode:
  # Enable chrome nodes
  enabled: true

  # NOTE: Only used when autoscaling.enabled is false
  # Enable creation of Deployment
  # true (default) - if you want long living pods
  # false - for provisioning your own custom type such as Jobs
  deploymentEnabled: true

  # Number of chrome nodes
  replicas: 10
  # imageRegistry: selenium
  # Image of chrome nodes
  imageName: node-chrome
  resources:
    requests:
      memory: "2Gi"
      cpu: "1"
    limits:
      memory: "3Gi"
      cpu: "3"

  extraEnvironmentVariables:
    - name: SE_SESSION_RETRY_INTERVAL
      value: "5"
    - name: SE_NODE_SESSION_TIMEOUT
      value: "7200"    

firefoxNode:
  # Enable firefox nodes
  enabled: true

  # NOTE: Only used when autoscaling.enabled is false
  # Enable creation of Deployment
  # true (default) - if you want long living pods
  # false - for provisioning your own custom type such as Jobs
  deploymentEnabled: true

  # Number of firefox nodes
  replicas: 2
  # imageRegistry: selenium
  # Image of firefox nodes
  imageName: node-firefox
  resources:
    requests:
      memory: "1Gi"
      cpu: "1"
    limits:
      memory: "2Gi"
      cpu: "2"
  extraEnvironmentVariables:
    - name: SE_SESSION_RETRY_INTERVAL
      value: "5"
    - name: SE_NODE_SESSION_TIMEOUT
      value: "3600"       

edgeNode:
  # Enable edge nodes
  enabled: true

  # NOTE: Only used when autoscaling.enabled is false
  # Enable creation of Deployment
  # true (default) - if you want long living pods
  # false - for provisioning your own custom type such as Jobs
  deploymentEnabled: true

  # Number of edge nodes
  replicas: 2
  # imageRegistry: selenium
  # Image of edge nodes
  imageName: node-edge
  resources:
    requests:
      memory: "1Gi"
      cpu: "1"
    limits:
      memory: "2Gi"
      cpu: "2"
  extraEnvironmentVariables:
    - name: SE_SESSION_RETRY_INTERVAL
      value: "5"
    - name: SE_NODE_SESSION_TIMEOUT
      value: "3600"

Relevant log output

urllib3.connectionpool:connectionpool.py:872 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fac7f217670>: Failed to establish a new connection: [Errno 111] Connection refused')'

selenium.common.exceptions.InvalidSessionIdException: Message: Unable to find session with ID: 3cff0b1bcb48d1caf20bd9986ec25401
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.205-195.807.amzn2.x86_64', java.version: '11.0.21'
Driver info: driver.version: unknown
Stacktrace:
org.openqa.selenium.NoSuchSessionException: Unable to find session with ID: 3cff0b1bcb48d1caf20bd9986ec25401
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.205-195.807.amzn2.x86_64', java.version: '11.0.21'
Driver info: driver.version: unknown
    at org.openqa.selenium.grid.sessionmap.local.LocalSessionMap.get(LocalSessionMap.java:132)
    at org.openqa.selenium.grid.sessionmap.SessionMap.getUri(SessionMap.java:84)
    at org.openqa.selenium.grid.router.HandleSession.lambda$loadSessionId$4(HandleSession.java:223)
    at io.opentelemetry.context.Context.lambda$wrap$2(Context.java:224)
    at org.openqa.selenium.grid.router.HandleSession.execute(HandleSession.java:180)
    at org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:383)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.grid.router.Router.execute(Router.java:87)
    at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$NestedRoute.handle(Route.java:270)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
    at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
    at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Operating System

kubernetes

Docker Selenium version (image tag)

4.17.0

Selenium Grid chart version (chart version)

No response

github-actions[bot] commented 6 months ago

@YaronMordAnaplan, 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] commented 6 months ago

Hi, @YaronMordAnaplan. Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

diemol commented 6 months ago

We added the issue template label because we need a way to reproduce the issue.

VietND96 commented 6 months ago

urllib3.connectionpool:connectionpool.py:872 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fac7f217670>: Failed to establish a new connection: [Errno 111] Connection refused')' What is the Grid URL that you provided to create RemoteWebDriver?

ghost commented 4 months ago

@YaronMordAnaplan can you try using a specific version of e.g node-chrome in your yml file. Considering that version 4.17.0 was only released 3 months ago, maybe try using an earlier version just to see if it resolves the issue. That would at least provide more insight as to whether the issue is related to versions