Selenium Grid (v4) session "Duration" goes beyoung 10days

111 views Asked by At

We have a Selenium Grid setup via docker on an ubuntu machine with the following settings


# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
  chrome:
    image: selenium/node-chrome:4.5.0-20221017
    shm_size: 8gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_MAX_SESSIONS=200
      - SE_NODE_OVERRIDE_MAX_SESSIONS=true
      - SE_SCREEN_WIDTH=1920
      - SE_SCREEN_HEIGHT=1080

  selenium-hub:
    image: selenium/hub:4.5.0-20221017
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"


Some sessions on this grid "hang". enter image description here

Also, I can not connect to the session to close them manually. Only restart of the Grid helps. I know that some of the UI tests may not do a proper cleanup, but still, Selenium Grid docker docs say that timeout is 300 sec by default enter image description here

Anyone experienced the same problem & can suggest a solution?

1

There are 1 answers

2
Alexey R. On

I was facing such issues as well. This might happen if you do not use quit() in your tests or it is bypassed due to some exceptions.

So that leads to the session remains open.

I do not know why timeout does not kill the session automatically. Probably it is worth raising issue at Selenium github project. But as a workaround you could use DELETE query to the hub

So no need to restart the entire grid.