SeleniumHQ / SeleniumHQ/docker-selenium

[🐛 Bug]: Recording video, files with the session ID only in the name

Open
#2,390 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?

We are running Selenium in AKS, with a PVC attached to the video container mounted in the record1 directory, where the uploader (internal) transfers the recordings. Most of the recordings in the record1 folder are valid, with correct names such as MultiTabNotEmptyTest_202409091415181_v4.mp4. However, from time to time, files are created that contain only the session ID in their names, e.g., 06f6fea74cc1b473b792956c2055d425.mp4. These files do not contain any recordings. We have set the variable SE_VIDEO_FILE_NAME_SUFFIX="false", so files with such names should not appear.

Command used to start Selenium Grid with Docker (or Kubernetes)
videoRecorder:
  enabled: true
  # Container name is set to resource specs
  name: video
  # imageRegistry: selenium
  # Image of video recorder
  imageName: video
  # Image of video recorder
  # imageTag: ffmpeg-7.0.2-20240830
  # Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images)
  imagePullPolicy: IfNotPresent
  # Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
  targetFolder: "/videos"
  uploader:
    enabled: true
    # Where to upload the video file e.g. remoteName://bucketName/path. Refer to destination syntax of rclone https://rclone.org/docs/
    destinationPrefix:
      /records1
    # What uploader to use. See .videRecorder.s3 for how to create a new one.
    name:
    configFileName: upload.conf
    entryPointFileName: upload.sh
    # For environment variables used in uploader which contains sensitive information, store in secret and refer envFrom
    # Set config for rclone via ENV var with format: RCLONE_CONFIG_ + name of remote + _ + name of config file option (make it all uppercase)
    secrets:
    #  RCLONE_CONFIG_S3_TYPE: "s3"
    #  RCLONE_CONFIG_S3_PROVIDER: "AWS"
    #  RCLONE_CONFIG_S3_ENV_AUTH: "true"
    #  RCLONE_CONFIG_S3_REGION: "ap-southeast-1"
    #  RCLONE_CONFIG_S3_LOCATION_CONSTRAINT: "ap-southeast-1"
    #  RCLONE_CONFIG_S3_ACL: "private"
    #  RCLONE_CONFIG_S3_ACCESS_KEY_ID: "xxx"
    #  RCLONE_CONFIG_S3_SECRET_ACCESS_KEY: "xxx"
    #  RCLONE_CONFIG_S3_NO_CHECK_BUCKET: "true"
    #  RCLONE_CONFIG_GS_TYPE: "s3"
    #  RCLONE_CONFIG_GS_PROVIDER: "GCS"
    #  RCLONE_CONFIG_GS_ENV_AUTH: "true"
    #  RCLONE_CONFIG_GS_REGION: "asia-southeast1"
    #  RCLONE_CONFIG_GS_LOCATION_CONSTRAINT: "asia-southeast1"
    #  RCLONE_CONFIG_GS_ACL: "private"
    #  RCLONE_CONFIG_GS_ACCESS_KEY_ID: "xxx"
    #  RCLONE_CONFIG_GS_SECRET_ACCESS_KEY: "xxx"
    #  RCLONE_CONFIG_GS_ENDPOINT: "https://storage.googleapis.com"
    #  RCLONE_CONFIG_GS_NO_CHECK_BUCKET: "true"  
  ports:
    - 9000
  resources:
    requests:
      memory: "100Mi"
      cpu: "50m"
    limits:
      memory: "800Mi"
      cpu: "100m"
  # SecurityContext for recorder container
  securityContext:
  extraEnvironmentVariables:
   - name: SE_VIDEO_FOLDER
     value: /videos
   - name: SE_VIDEO_FILE_NAME_SUFFIX
     value: "false"
   - name: SE_VIDEO_UPLOAD_ENABLED
     value: "true"
   - name: SE_VIDEO_INTERNAL_UPLOAD
     value: "true"
  # Custom environment variables by sourcing entire configMap, Secret, etc. for video recorder.
  extraEnvFrom:
  # - configMapRef:
  #   name: proxy-settings
  # - secretRef:
  #   name: mysecret
  # Wait for pod startup
  terminationGracePeriodSeconds: 30

  # Wait for pod startup
  startupProbe: {}
  #   httpGet:
  #     path: /
  #     port: 9000
  #   failureThreshold: 120
  # periodSeconds: 5

  # Liveness probe settings
  livenessProbe: {}
  # Define lifecycle events for video recorder
  lifecycle: {}

  # Custom video recorder back-end scripts (video.sh, video_ready.py, etc.) further by ConfigMap.
  # NOTE: For the mount point with the name "video", or "video-scripts", it will override the default. For other names, it will be appended.
  extraVolumeMounts:
  # - name: video-scripts
  #   mountPath: /opt/bin/video.sh
  #   subPath: custom_video.sh
  # - name: video-scripts
  #   mountPath: /opt/bin/video_ready.py
  #   subPath: video_ready.py
  - name: records1
    mountPath: /records1


  extraVolumes:
  # - name: video-scripts
  #   configMap:
  #     name: my-video-scripts-cm
  #     defaultMode: 0500
  # - name: video
  #   persistentVolumeClaim:
  #     claimName: video-pv-claim
  - name: records1
    persistentVolumeClaim:
      claimName: pvc-smb-vid1
Relevant log output
Defaulted container "selenium-grid1-selenium-chrome-node" out of: selenium-grid1-selenium-chrome-node, video
2024-09-09 15:52:26,244 INFO Included extra file "/etc/supervisor/conf.d/chrome-cleanup.conf" during parsing
2024-09-09 15:52:26,244 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
2024-09-09 15:52:26,247 INFO RPC interface 'supervisor' initialized
2024-09-09 15:52:26,247 INFO supervisord started with pid 8
2024-09-09 15:52:27,248 INFO spawned: 'xvfb' with pid 9
2024-09-09 15:52:27,250 INFO spawned: 'vnc' with pid 10
2024-09-09 15:52:27,251 INFO spawned: 'novnc' with pid 11
2024-09-09 15:52:27,252 INFO spawned: 'selenium-node' with pid 12
2024-09-09 15:52:27,256 INFO success: selenium-node entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Appending Selenium option: --session-timeout 300
Appending Selenium option: --register-period 60
Appending Selenium option: --register-cycle 5
Appending Selenium option: --heartbeat-period 30
Appending Selenium option: --log-level INFO
Appending Selenium option: --http-logs false
Appending Selenium option: --structured-logs false
Generating Selenium Config
Setting up SE_NODE_HOST...
Appending Selenium option: --tracing false
Tracing is disabled
Selenium Grid Node configuration:
[events]
publish = "tcp://selenium-grid1-selenium-hub.default:4442"
subscribe = "tcp://selenium-grid1-selenium-hub.default:4443"

[server]
port = "5555"
[node]
grid-url = "http://selenium-grid1-selenium-hub.default:4444"
session-timeout = "300"
override-max-sessions = false
detect-drivers = false
drain-after-session-count = 1
max-sessions = 1

[[node.driver-configuration]]
display-name = "chrome"
stereotype = '{"browserName": "chrome", "browserVersion": "128.0", "platformName": "Linux", "goog:chromeOptions": {"binary": "/usr/bin/google-chrome"}, "se:containerName": "selenium-grid1-selenium-chrome-node-8l9mf-thrkm"}'
max-sessions = 1

Starting Selenium Grid Node...
2024-09-09 15:52:28,282 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-09-09 15:52:28,282 INFO success: vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-09-09 15:52:28,282 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
15:52:28.480 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
15:52:28.485 INFO [LoggingOptions.getTracer] - Using null tracer
15:52:28.523 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-grid1-selenium-hub.default:4442 and tcp://selenium-grid1-selenium-hub.default:4443
15:52:28.684 INFO [UnboundZmqEventBus.<init>] - Sockets created
15:52:29.686 INFO [UnboundZmqEventBus.<init>] - Event bus ready
15:52:29.799 INFO [NodeServer.createHandlers] - Reporting self as: http://10.244.124.85:5555
15:52:29.802 INFO [LoggingOptions.getTracer] - Using null tracer
15:52:29.812 INFO [NodeOptions.getSessionFactories] - Detected 1 available processors
15:52:29.902 INFO [NodeOptions.report] - Adding chrome for {"browserName": "chrome","browserVersion": "128.0","goog:chromeOptions": {"binary": "\u002fusr\u002fbin\u002fgoogle-chrome"},"platformName": "linux","se:containerName": "selenium-grid1-selenium-chrome-node-8l9mf-thrkm","se:noVncPort": 7900,"se:vncEnabled": true} 1 times
15:52:29.917 INFO [Node.<init>] - Binding additional locator mechanisms: relative
15:52:30.198 INFO [NodeServer$1.start] - Starting registration process for Node http://10.244.124.85:5555
15:52:30.199 INFO [NodeServer.execute] - Started Selenium node 4.24.0 (revision 748ffc9bc3): http://10.244.124.85:5555
15:52:30.210 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
15:52:30.403 INFO [NodeServer.lambda$createHandlers$2] - Node has been added
2024-09-09T15:52:30CEST [Probe.Startup] - Node responds the ID: 963fac4c-dfcf-4747-b411-cd96bdb68638 with status: UP
2024-09-09T15:52:31CEST [Probe.Startup] - Grid responds a matched Node ID: 963fac4c-dfcf-4747-b411-cd96bdb68638
2024-09-09T15:52:31CEST [Probe.Startup] - Node ID: 963fac4c-dfcf-4747-b411-cd96bdb68638 is found in the Grid. Node is ready.
15:52:32.186 INFO [LocalNode.checkSessionCount] - Draining Node, configured sessions value (1) has been reached.
15:52:32.192 INFO [LocalNode.newSession] - Session created by the Node. Id: 87905f84629238fb646bf56b11b7080b, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 128.0.6613.113, chrome: {chromedriverVersion: 128.0.6613.86 (3045ed680fda..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:42985}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://selenium-grid1-seleniu..., se:cdpVersion: 128.0.6613.113, se:containerName: selenium-grid1-selenium-chr..., se:name: CheckCompanyAfterDeleteMult..., se:noVncPort: 7900, se:recordVideo: true, se:screenResolution: 1920x1080, se:vnc: ws://selenium-grid1-seleniu..., se:vncEnabled: true, se:vncLocalAddress: ws://10.244.124.85:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
15:57:59.996 INFO [LocalNode.stopTimedOutSession] - Session id 87905f84629238fb646bf56b11b7080b timed out, stopping...
15:58:00.091 INFO [SessionSlot.stop] - Stopping session 87905f84629238fb646bf56b11b7080b
15:58:00.092 INFO [LocalNode.stopTimedOutSession] - Node draining complete!
15:58:01.115 INFO [NodeServer.lambda$createHandlers$3] - Shutting down
2024-09-09 15:58:01,504 INFO exited: selenium-node (exit status 0; expected)
2024-09-09 15:58:01,504 WARN received SIGINT indicating exit request
2024-09-09 15:58:01,505 INFO waiting for xvfb, vnc, novnc to die
2024-09-09 15:58:04,508 WARN stopped: novnc (terminated by SIGTERM)
2024-09-09 15:58:04,508 INFO waiting for xvfb, vnc to die
2024-09-09 15:58:05,509 WARN stopped: vnc (terminated by SIGTERM)
2024-09-09 15:58:06,510 WARN stopped: xvfb (terminated by SIGTERM)
Operating System

Azure Kubernetes Service

Docker Selenium version (image tag)

4.24.0-20240830

Selenium Grid chart version (chart version)

0.35.0

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

No repository file or test is named in the report. Start with the video recorder configuration and the logged session-timeout shutdown path, then reproduce the issue with SE_VIDEO_FILE_NAME_SUFFIX=false; done means explaining and preventing empty session-ID-only MP4 files.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.