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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Unable to override session timeout and other configuration parameters using toml file #2559

Open
mcichonqa opened this issue Jan 5, 2025 · 4 comments

Comments

@mcichonqa
Copy link

What happened?

Hi, at start I would like to say its only a question. I wanted to use for hub and node's several configuration files as config.toml, but some sections didn't read well and Im confused about that. Could you explain how can I override session timeout and others parameters?

In my chrome-config.toml I have short configuration and I want to override session timeout parameter. I know default value is 300, but I don't understand, why my session timeout with value like 60 is not used from my toml file?
Now im only able to override session timeout and some parameters using environment in docker compose yaml like SE_NODE_SESSION_TIMEOUT=60 or just SE_OPTS=--session-timeout 60.
Is it possible to set session-timeout inside toml file below [node] section? I would like to have all parameters in toml file not in environment section inside docker yaml.

I have also problems with other sections like [logging]. Any parameters from this section is not applied and in console I see something like "Appending Selenium option: --log-level INFO", but my toml file includes log-level = "FINE".
It looks like my toml file is used 50% parameters only and some parameters are not recognized.

These parameters are recognized and applied:
detect-drivers = true
max-sessions = 1
all below [[node.driver-configuration]] works

This is my toml file

[events]
publish = "tcp://selenium-hub:4442"
subscribe = "tcp://selenium-hub:4443"

[logging]
log-level = "FINE"

[node]
session-timeout = 60
detect-drivers = true
max-sessions = 1

[[node.driver-configuration]]
display-name = "Chrome"
stereotype = '{ "browserName": "chrome", "browserVersion": "131", "platformName": "LINUX" }'
webdriver-executable = "/opt/selenium/chromedriver-131.0.6778.204"

[[node.driver-configuration]]
display-name = "Edge"
stereotype = '{ "browserName": "MicrosoftEdge", "browserVersion": "131", "platformName": "windows" }'
webdriver-executable = "/opt/selenium/msedgedriver-131.0.2903.112"

Thanks in advance.

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

version: "3"
services:
  node-1:
    image: selenium-node:v1
    container_name: node-1
    networks:
      - selenium
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_ENABLE_TRACING=false
      # - SE_NODE_SESSION_TIMEOUT=60
      # - SE_NODE_HEARTBEAT_PERIOD=55
      # - SE_LOG_LEVEL=INFO
      # - SE_HTTP_LOGS=true
      # - SE_STRUCTURED_LOGS=true
      - GENERATE_CONFIG=false
      - CONFIG_FILE=/opt/selenium/config.toml
      - SE_OPTS=--log /opt/selenium/logs/selenium-node-1.log
    volumes:
      - ./videos:/videos
      - ./chrome-config.toml:/opt/selenium/config.toml
      - ./logs/selenium-node-1.log:/opt/selenium/logs/selenium-node-1.log
    deploy:
      resources:
        limits:
          cpus: "1.0"
          memory: 1GB
		  
  selenium-hub:
	image: selenium/hub:4.27.0
	container_name: selenium-hub
	networks:
	  - selenium
	environment:
	  - SE_ENABLE_TRACING=false
	ports:
	  - "4442:4442"
	  - "4443:4443"
	  - "4444:4444"
	deploy:
	  resources:
		limits:
		  cpus: "4.0"
		  memory: 4GB

networks:
  selenium:
    name: selenium-grid
    driver: bridge

Relevant log output

selenium-hub    | 2025-01-05 17:54:44,337 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-hub.conf" during parsing
selenium-hub    | 2025-01-05 17:54:44,339 INFO RPC interface 'supervisor' initialized
selenium-hub    | 2025-01-05 17:54:44,339 INFO supervisord started with pid 8
node-1          | 2025-01-05 17:54:44,644 INFO Included extra file "/etc/supervisor/conf.d/chrome-cleanup.conf" during parsing
node-1          | 2025-01-05 17:54:44,644 INFO Included extra file "/etc/supervisor/conf.d/edge-cleanup.conf" during parsing
node-1          | 2025-01-05 17:54:44,644 INFO Included extra file "/etc/supervisor/conf.d/recorder.conf" during parsing
node-1          | 2025-01-05 17:54:44,644 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
node-1          | 2025-01-05 17:54:44,644 INFO Included extra file "/etc/supervisor/conf.d/uploader.conf" during parsing
node-1          | 2025-01-05 17:54:44,646 INFO RPC interface 'supervisor' initialized
node-1          | 2025-01-05 17:54:44,647 INFO supervisord started with pid 8
selenium-hub    | 2025-01-05 17:54:45,341 INFO spawned: 'selenium-grid-hub' with pid 9
selenium-hub    | Starting Selenium Grid Hub...
selenium-hub    | 2025-01-05 17:54:45,344 INFO success: selenium-grid-hub entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
selenium-hub    | Appending Selenium option: --log-level INFO
selenium-hub    | Appending Selenium option: --http-logs false
selenium-hub    | Appending Selenium option: --structured-logs false
selenium-hub    | Appending Selenium option: --reject-unsupported-caps false
selenium-hub    | Appending Selenium option: --session-request-timeout 300
selenium-hub    | Appending Selenium option: --session-retry-interval 15
selenium-hub    | Appending Selenium option: --healthcheck-interval 120
selenium-hub    | Appending Selenium option: --relax-checks true
selenium-hub    | Appending Selenium option: --bind-host false
selenium-hub    | Appending Selenium option: --config /opt/selenium/config.toml
selenium-hub    | Appending Selenium option: --tracing false
selenium-hub    | Tracing is disabled
selenium-hub    | 17:54:45.617 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-hub    | 17:54:45.622 INFO [LoggingOptions.getTracer] - Using null tracer
node-1          | 2025-01-05 17:54:45,649 INFO spawned: 'xvfb' with pid 9
selenium-hub    | 17:54:45.649 INFO [BoundZmqEventBus.<init>] - XPUB binding to [binding to tcp://*:4442, advertising as tcp://172.18.0.2:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://172.18.0.2:4443]
node-1          | 2025-01-05 17:54:45,650 INFO spawned: 'video-upload' with pid 10
node-1          | 2025-01-05 17:54:45,651 INFO spawned: 'vnc' with pid 11
node-1          | 2025-01-05 17:54:45,653 INFO spawned: 'novnc' with pid 12
node-1          | 2025-01-05 17:54:45,654 INFO spawned: 'selenium-node' with pid 14
node-1          | 2025-01-05 17:54:45,655 [video.uploader] - UPLOAD_RETAIN_LOCAL_FILE is set to false, force to use RCLONE command: move
node-1          | 2025-01-05 17:54:45,655 INFO success: video-upload entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
node-1          | 2025-01-05 17:54:45,655 INFO success: selenium-node entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
node-1          | 2025-01-05 17:54:45,658 [video.uploader] - Waiting for /tmp/uploadpipe to be present
selenium-hub    | 17:54:45.694 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://172.18.0.2:4442 and tcp://172.18.0.2:4443
selenium-hub    | 17:54:45.708 INFO [UnboundZmqEventBus.<init>] - Sockets created
node-1          | Appending Selenium options: --log /opt/selenium/logs/selenium-node-1.log
node-1          | Appending Selenium option: --session-timeout 300
node-1          | Appending Selenium option: --heartbeat-period 55
node-1          | Appending Selenium option: --log-level INFO
node-1          | Appending Selenium option: --http-logs true
node-1          | Appending Selenium option: --structured-logs true
node-1          | Appending Selenium option: --tracing false
node-1          | Tracing is disabled
node-1          | Appending Selenium option: --bind-host false
node-1          | Appending Selenium option: --config /opt/selenium/config.toml
node-1          | Selenium Grid Node configuration: 
node-1          | [events]
node-1          | publish = "tcp://selenium-hub:4442"
node-1          | subscribe = "tcp://selenium-hub:4443"
node-1          | 
node-1          | [logging]
node-1          | log-level = "FINE"
node-1          | 
node-1          | [node]
node-1          | session-timeout = 60
node-1          | detect-drivers = true
node-1          | max-sessions = 1
node-1          | 
node-1          | [[node.driver-configuration]]
node-1          | display-name = "Chrome"
node-1          | stereotype = '{ "browserName": "chrome", "browserVersion": "131", "platformName": "LINUX" }'
node-1          | webdriver-executable = "/opt/selenium/chromedriver-131.0.6778.204"
node-1          | 
node-1          | [[node.driver-configuration]]
node-1          | display-name = "Edge"
node-1          | stereotype = '{ "browserName": "MicrosoftEdge", "browserVersion": "131", "platformName": "windows" }'
node-1          | webdriver-executable = "/opt/selenium/msedgedriver-131.0.2903.112"Starting Selenium Grid Node...
node-1          | 2025-01-05 17:54:46,698 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
node-1          | 2025-01-05 17:54:46,698 INFO success: vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
node-1          | 2025-01-05 17:54:46,698 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
selenium-hub    | 17:54:46.709 INFO [UnboundZmqEventBus.<init>] - Event bus ready
selenium-hub    | 17:54:47.102 INFO [Hub.execute] - Started Selenium Hub 4.27.0 (revision d6e718d): http://172.18.0.2:4444
selenium-hub    | 17:54:48.552 INFO [Node.<init>] - Binding additional locator mechanisms: relative
selenium-hub    | 17:54:48.809 INFO [GridModel.setAvailability] - Switching Node d7f685f1-bbc4-4918-b332-b9cda7be4b59 (uri: http://172.18.0.3:5555) from DOWN to UP
selenium-hub    | 17:54:48.809 INFO [LocalDistributor.add] - Added node d7f685f1-bbc4-4918-b332-b9cda7be4b59 at http://172.18.0.3:5555. Health check every 120s

Operating System

WSL2 Ubuntu-22.04

Docker Selenium version (image tag)

4.27.0

Selenium Grid chart version (chart version)

No response

Copy link

github-actions bot commented Jan 5, 2025

@mcichonqa, 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

VietND96 commented Jan 6, 2025

In Node entrypoint, there is a config

if [ ! -z "$SE_NODE_SESSION_TIMEOUT" ]; then
  append_se_opts "--session-timeout" "${SE_NODE_SESSION_TIMEOUT}"
fi

And by default it is 300, so it always pass CLI option, which takes higher precedence than TOML config
Can you try to set it as empty by

- SE_NODE_SESSION_TIMEOUT=

@mcichonqa
Copy link
Author

Okay, so default CLI options have higher precedence and specific toml parameters are ignored always in that cases. I have to mix my configuration between docker yaml and toml. Is it ok?

Thanks for explanation!

@VietND96
Copy link
Member

VietND96 commented Jan 6, 2025

Yes, in YAML set env var SE_NODE_SESSION_TIMEOUT to empty. In TOML, set your expected value.
In container logs, when starting up, this line Appending Selenium option: --session-timeout 300 should not be present.

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

2 participants