Skip to content

[πŸ› Bug]: Memory Leak Issue ReportΒ #14534

@ChimeraFlutter

Description

@ChimeraFlutter

What happened?

# Memory Leak Issue Report

## Environment Information
- **Chrome Version**: 129.0.6668.59
- **ChromeDriver Version**: 129.0.6668.58
- **Operating System**: [Please specify your operating system]

## Steps to Reproduce
1. Open Chrome and enable DevTools.
2. Use the following code snippet to continuously perform the find operation:

   ```python
   while True:
       driver.find_element(By.CLASS_NAME, "menu")

Issue Description

After repeatedly calling the find_element method, memory usage rapidly increases, eventually causing the browser to crash. The following string appears continuously:

"(function(){ return (function() { // Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * Enum for WebDriver status codes.
 * @enum {number}
 */
const StatusCode = {
  STALE_ELEMENT_REFERENCE: 10,
  JAVA_SCRIPT_ERROR: 17,
  NO_SUCH_SHADOW_ROOT: 65,
  DETACHED_SHADOW_ROOT: 66
};

/**
 * Enum for node types.
 * @enum {number}
 */
const NodeType = {
  ELEMENT: 1,
  DOCUMENT: 9,
};

/**
 * Dictionary key to use for holding an element ID.
 * @const
 * @type {string}
 */
var ELEMENT_KEY = 'ELEMENT';

/**
 * Dictionary key to use for holding a shadow element ID.
 * @const
 * @type {string}
 */
const SHADOW_ROOT_KEY = 'shadow-6066-11e4-a52e-4f735466cecf';
const W3C_ELEMENT_KEY = 'element-6066-11e4-a52e-4f735466cecf';

/**
 * True if using W3C Element references.
 * @const
 * @type {boolean}
 */
var w3cEnabled = false;

/**
 * True if shadow dom is enabled.
 * @const
 * @type {boolean}
 */
const SHADOW_DOM_ENABLED = typeof S"

Expected Result

Memory usage should remain stable during normal usage of WebDriver, and the browser should not crash.

Actual Result

After some time, memory usage spikes dramatically, leading to the eventual crash of the browser.

Additional Information

  • Please provide any logs or details that may be needed.

Thank you for your efforts, and I look forward to your feedback!


Feel free to copy and paste this Markdown content!

### How can we reproduce the issue?

```shell
while True:
       driver.find_element(By.CLASS_NAME, "menu")

Relevant log output

None

Operating System

Windows 11

Selenium version

ChromeDriver Version**: 129.0.6668.58

What are the browser(s) and version(s) where you see this issue?

Chrome Version**: 129.0.6668.59

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver Version**: 129.0.6668.58

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    G-chromedriverRequires fixes in ChromeDriver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions