Skip to content

[🐛 Bug]: HeapDumpOnOutOfMemoryError process consumes a lot of memory #2706

@ANDREWY-3

Description

@ANDREWY-3

What happened?

Hi all,

I have a Debian server with 60 CPUs and 60GB of RAM, running 15 Dockerized Selenium Chrome instances. Currently, I'm using version 134/latest, and I've noticed that after running tests for a while, the server runs out of RAM. Upon inspecting a Docker instance, I observed that a specific process is consuming a significant amount of memory. java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/selenium/logs .......

Even when the instance is idle, its memory usage gradually increases, reaching around 1GB over time. This issue wasn't present in previous versions of Selenium Docker.

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

standalone-instance1:
    build: ./dockerfiles/chrome
    restart: always
    ports:
      - "4444:4444"
      - "7900:7900"
    volumes:
      - /var/www/html/downloads/c/1:/home/seluser/Downloads/c
    shm_size: 2g
    environment:
      - TZ=Asia/Nicosia
      - SE_OPTS=--enable-managed-downloads true
      - ENABLE_VNC=false
      - SE_START_VNC=false
      - SE_START_NO_VNC=false
      - SEL_DOWNLOAD_DIR=/home/seluser/Downloads
      - SCREEN_WIDTH=1920
      - SCREEN_HEIGHT=1080
      - SCREEN_DEPTH=24
      - SE_NODE_SESSION_TIMEOUT=3600
      - SE_SESSION_REQUEST_TIMEOUT=3600
      - SE_NODE_MAX_SESSIONS=1
      - SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true
      - SE_BROWSER_LEFTOVERS_PROCESSES_SECS=1200
    ulimits:
      nproc: 65535
      nofile: 65535
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

Profile loaded on session

    'goog:chromeOptions': {
        prefs: {
            "credentials_enable_service": false,
            "profile.password_manager_enabled": false,
            "profile.default_content_setting_values.notifications": 1,
            'profile.managed_default_content_settings.popups': 0,
            'profile.managed_default_content_settings.notifications': 1,
            "download.default_directory": `/home/seluser/Downloads/`,
            "download.prompt_for_download": false,
            "download.directory_upgrade": true,
            "safebrowsing.enabled": true,
            "timeZone": "Asia/Nicosia"
        },
        args: [
            'user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Selenium',
            '--disable-infobars',
            '--window-size=1920,1080',
            '--ignore-certificate-errors',
            '--ignore-ssl-errors=true',
            '--use-fake-ui-for-media-stream',
            '--use-fake-device-for-media-stream',
            '--disable-gpu',
            '--headless=new',
            '--disable-dev-shm-usage',
            '--disable-popup-blocking',
            '--no-sandbox',
            'start-maximized',
            '--disable-blink-features=AutomationControlled'
        ]
    }

Relevant log output

seluser@46e42a978dbc:/$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem
    PID    PPID CMD                         %MEM %CPU
     87      14 java -XX:+HeapDumpOnOutOfMe  6.5  1.1
      8       1 /usr/bin/python3 /usr/bin/s  0.0  0.0
     36      17 Xvfb :99 -screen 0 1920x108  0.0  0.0
     34       1 pulseaudio -D --exit-idle-t  0.0  0.1
 103114       0 /bin/bash                    0.0  0.0
 103574  103114 ps -eo pid,ppid,cmd,%mem,%c  0.0  0.0
  90128   90127 /bin/bash /opt/bin/chrome-c  0.0  0.0
  90127       8 bash -c if [ ${SE_ENABLE_BR  0.0  0.0
     42      17 /usr/bin/fluxbox -display :  0.0  0.0
 102134   90128 sleep 3600                   0.0  0.0
     14      12 bash /opt/bin/start-seleniu  0.0  0.0
      1       0 bash /opt/bin/entry_point.s  0.0  0.0
      9       8 bash /opt/bin/start-xvfb.sh  0.0  0.0
     12       8 bash -c /opt/bin/start-sele  0.0  0.0
     17       9 /bin/sh /usr/bin/xvfb-run -  0.0  0.0

Operating System

Debian 12

Docker Selenium version (image tag)

latest

Selenium Grid chart version (chart version)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions