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

オープン
#3,153 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker

調査の方向性

まず pull request 3131 の前後の動作を比較し、次に video_recorder.py、video.sh、提供された config.toml を調べます。記載された systemd quadlet と browser/recorder イメージを使って問題を再現します。完了条件は、スタンドアロンの recorder だけが ffmpeg を実行し、browser コンテナが 2 つ目の動画ファイルを作成しないことです。

索引モデルが issue の本文から書いたものです。

説明

needs-triaging
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

主要言語
Go
スター
8.7k
フォーク
2.5k
平均マージ
1日 15時間
マージ済み PR(30日)
37

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SeleniumHQ/docker-selenium のほかの issue

SeleniumHQ/docker-selenium の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。