SeleniumHQ / SeleniumHQ/docker-selenium

[🐛 Bug]: Duplicate video recording processes in dynamic Grid with standalone video container

Open
#3,153 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triaging
Dominant language
Go
Stars
8.7k
Forks
2.5k
Avg merge
10h 16m
Merged PRs (30d)
20

Description

What happened?

As of Grid v4.44.0, in a dynamic grid deployment using the standalone video container, both the browser and the video container run ffmpeg, instead of just the video container. This doubles the load and leads to OOM-killer being triggered on our Grid server.

It looks like https://github.com/SeleniumHQ/docker-selenium/pull/3131 caused this. If I pin the browser container to the older version in config.toml, then only the recorder container tries to create the video file, as expected.

config.toml:

[docker]
configs = [
  "selenium/standalone-firefox:4.44.0-20260505", '{"browserName": "firefox", "platformName": "linux"}',
  "selenium/standalone-chrome:4.44.0-20260505", '{"browserName": "chrome", "platformName": "linux"}',
  "selenium/standalone-edge:4.44.0-20260505", '{"browserName": "MicrosoftEdge", "platformName": "linux"}'
]
host-config-keys = ["Dns", "DnsOptions", "DnsSearch", "ExtraHosts", "Binds"]
url = "http://127.0.0.1:2375"
video-image = "selenium/video:ffmpeg-8.1-20260505"

Quadlets:

# cat /etc/containers/systemd/selenium-hub.container 
[Container]
ContainerName=selenium-hub
Image={PROXY_REGISTRY}/selenium/hub:4.44.0-20260505
LogDriver=journald
Network=selenium-grid.network
PublishPort=4442:4442
PublishPort=4443:4443
PublishPort=4444:4444
PublishPort=[::]:4442:4442
PublishPort=[::]:4443:4443
PublishPort=[::]:4444:4444

[Unit]
StartLimitIntervalSec=30
StartLimitBurst=2

[Service]
Restart=always

[Install]
WantedBy=default.target

# cat /etc/containers/systemd/selenium-node.container 
[Container]
ContainerName=selenium-node
Environment=DOCKER_SOCK=/var/run/podman/podman.sock
Environment=SE_EVENT_BUS_HOST=selenium-hub
Environment=SE_VIDEO_RECORD_STANDALONE=True
Image={PROXY_REGISTRY}/selenium/node-docker:4.44.0-20260505
LogDriver=journald
Network=selenium-grid.network
Volume=/root/config.toml:/opt/selenium/docker.toml
Volume=/var/run/podman/podman.sock:/var/run/docker.sock
Volume=/var/www/html/videos:/opt/selenium/assets
PodmanArgs=--privileged

[Unit]
StartLimitIntervalSec=30
StartLimitBurst=2
After=selenium-hub.service

[Service]
Restart=always

[Install]
WantedBy=default.target

# cat /etc/containers/systemd/selenium-grid.network 
[Network]
NetworkName=selenium-grid
IPv6=true
Command used to start Selenium Grid with Docker (or Kubernetes)
systemctl start selenium-hub selenium-node
# See issue description for configuration files
Relevant log output
Example ps output showing both types of containers creating video files during a session:
# browser

root       58606       1  0 70729  2340   4 16:01 ?        00:00:00 /usr/bin/conmon [...] -n browser-chrome-1779912103789-09589650 [...]
1200       58618   58606  0  1868  3928  36 16:01 ?        00:00:00 bash /opt/bin/entry_point.sh
1200       58633   58618  0  9775 27744  25 16:01 ?        00:00:00 /home/seluser/venv/bin/python3 /home/seluser/venv/bin/supervisord --configuration /etc/supervisord.conf
1200       58643   58633  0 86582 35608  44 16:01 ?        00:00:00 python3 /opt/bin/video_recorder.py
1200       59917   58643 39 243620 110644 67 16:01 ?       00:00:23 ffmpeg -hide_banner -loglevel warning -threads 1 -thread_queue_size 512 -probesize 32M -analyzeduration 0 -y -f x11grab -video_size 1920x1080 -r 15 -i localhost:99.0 -codec:v libx264 -preset ultrafast -tune zerolatency -crf 28 -maxrate 1000k -bufsize 2000k -pix_fmt yuv420p -movflags frag_keyframe+empty_moov+default_base_moof /videos/9dcf6077b210526ac880b795741f6c93.mp4

# recorder

root       60454       1  0 70729  2340  71 16:01 ?        00:00:00 /usr/bin/conmon [...] -n recorder-chrome-1779912107824-21447003 [...]
1200       60465   60454  0  1081  3524  57 16:01 ?        00:00:00 bash /opt/bin/entry_point.sh
1200       60484   60465  0  8857 27344  54 16:01 ?        00:00:00 /home/seluser/venv/bin/python3 /home/seluser/venv/bin/supervisord --configuration /etc/supervisord.conf
1200       60490   60484  0  4207 11256  12 16:01 ?        00:00:00 python3 /opt/bin/video_recorder.py
1200       60492   60490  0  1210  3788  70 16:01 ?        00:00:00 bash /opt/bin/video.sh
1200       60503   60492 50 243425 109504 61 16:01 ?       00:00:28 ffmpeg -hide_banner -loglevel warning -threads 1 -thread_queue_size 512 -probesize 32M -analyzeduration 0 -y -f x11grab -video_size 1920x1080 -r 15 -i 10.89.0.34:99.0 -codec:v libx264 -preset ultrafast -tune zerolatency -crf 28 -maxrate 1000k -bufsize 2000k -pix_fmt yuv420p -movflags frag_keyframe+empty_moov+default_base_moof /videos/video.mp4
Operating System

RHEL 8

Docker Selenium version (image tag)

4.44.0-20260505

Selenium Grid chart version (chart version)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the behavior before and after pull request 3131, then inspect video_recorder.py, video.sh, and the supplied config.toml. Reproduce the issue with the listed systemd quadlets and browser/recorder images; done means only the standalone recorder runs ffmpeg and the browser container does not create a second video file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.