Skip to content

fix: cleanup protocol listeners - #33391

Merged
mschile merged 4 commits into
developfrom
mschile/protocol/cleanup
Feb 20, 2026
Merged

fix: cleanup protocol listeners#33391
mschile merged 4 commits into
developfrom
mschile/protocol/cleanup

Conversation

@mschile

@mschile mschile commented Feb 19, 2026

Copy link
Copy Markdown
Collaborator
  • Closes n/a

Additional details

Saw the following listeners leak:

[cy:open:dev:9026]: (node:9089) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Network.requestServedFromCache listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
[cy:open:dev:9026]: (node:9089) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Network.requestWillBeSent listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
[cy:open:dev:9026]: (node:9089) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Network.responseReceived listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
[cy:open:dev:9026]: (node:9089) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Network.loadingFailed listeners added to [EventEmitter]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit

Note

Medium Risk
Touches protocol lifecycle and CDP event wiring; mistakes could break Test Replay capture or leave listeners attached, but the changes are localized and covered by new unit tests.

Overview
Fixes capture protocol listener/resource leaks by introducing a cleanup() lifecycle method and ensuring it runs when the protocol is re-initialized (setupProtocol), when a spec fails early (beforeSpec error), and when the run closes (close).

Updates CDP client wrapping to track wrapped listeners per event+listener and implement off() so protocol code can reliably unregister listeners; unit tests and the test protocol fixture are updated accordingly, and the change is noted in the CLI changelog.

Written by Cursor Bugbot for commit b689d38. This will update automatically on new commits. Configure here.

Steps to test

n/a

How has the user experience changed?

n/a

PR Tasks

Comment thread packages/server/lib/cloud/protocol.ts
@cypress

cypress Bot commented Feb 19, 2026

Copy link
Copy Markdown

cypress    Run #69072

Run Properties:  status check passed Passed #69072  •  git commit b689d38637: fix lint
Project cypress
Branch Review mschile/protocol/cleanup
Run status status check passed Passed #69072
Run duration 19m 19s
Commit git commit b689d38637: fix lint
Committer Matthew Schile
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 10
Tests that did not run due to a developer annotating a test with .skip  Pending 1112
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 27178
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  61.04%
  Untested elements 28  
  Tested elements 47  
Accessibility  99.02%
  Failed rules  0 critical   3 serious   1 moderate   0 minor
  Failed elements 18  

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread packages/server/lib/cloud/protocol.ts
@mschile
mschile merged commit 282ca22 into develop Feb 20, 2026
92 of 94 checks passed
@mschile
mschile deleted the mschile/protocol/cleanup branch February 20, 2026 21:51
@cypress-bot

cypress-bot Bot commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Released in 15.11.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v15.11.0, please open a new issue.

@cypress-bot cypress-bot Bot locked as resolved and limited conversation to collaborators Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants