Skip to content

[🐛 Bug]: MaxListenersExceededWarning: Possible EventEmitter memory leak detected #14707

@HermansJarno

Description

@HermansJarno

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.15.0

Node.js Version

22.14.0

Mode

Standalone Mode

Which capabilities are you using?

{
  capabilities: {
    browserName: "chrome",
    browserVersion: "139.0.7258.67",
    "goog:chromeOptions": {
      args: [
        "--no-sandbox",
        "--remote-debugging-pipe",
        "--start-maximized",
        "--disable-infobars",
        "--lang=nl",
        "--window-size=1920,1080",
      ],
    },
  },
  waitforTimeout: 420000,
  logLevel: "warn",
}

What happened?

Facing bug MaxListenersExceededWarning which was mentioned in #3877 and #14297

What is your expected behavior?

No MaxListenerExceeded warning.

How to reproduce the bug.

The only thing I do is calling the reloadSession function in 1 test, 1 local chrome session. (standalone mode)

when running with node --trace-warnings i see the error occurs after await registerSessionManager which is triggered by reloadSession.

Relevant log output

(node:23132) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 command listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.
setMaxListeners() to increase limit
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at _addListener (node:events:592:17)
    at EventEmitter.addListener (node:events:610:10)
    at WebDriver.prototype.<computed> [as on] (file:///C:/Projects/myproject/node_modules/@wdio/utils/build/index.js:467:29)
    at new SessionManager (file:///C:/Projects/myproject/node_modules/webdriverio/build/node.js:153:21)
    at new _ContextManager (file:///C:/Projects/myproject/node_modules/webdriverio/build/node.js:263:5)
    at SessionManager.getSessionManager (file:///C:/Projects/myproject/node_modules/webdriverio/build/node.js:192:32)
    at getContextManager (file:///C:/Projects/myproject/node_modules/webdriverio/build/node.js:254:25)
    at registerSessionManager (file:///C:/Projects/myproject/node_modules/webdriverio/build/node.js:5072:5)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

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