fix: remove page.on() event listeners on environment close to prevent memory leak#59
Open
rahulrao85 wants to merge 1 commit into
Open
fix: remove page.on() event listeners on environment close to prevent memory leak#59rahulrao85 wants to merge 1 commit into
rahulrao85 wants to merge 1 commit into
Conversation
… memory leak The _attach_page_listeners method registered 'console' and 'pageerror' handlers via page.on() but these were never removed in _close_async(). Over long agent runs, orphaned listeners accumulate in the Playwright pyee event emitter, causing linear memory growth. Fixes: microsoft#57
|
@rahulrao85 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_attach_page_listeners()\ in \local_browser.py\ registers \page.on('console', ...)\ and \page.on('pageerror', ...)\ handlers but never removes them. The Playwright pyee event emitter retains references to the bound methods, causing a memory leak that grows linearly with agent steps.
Changes
Testing
Fixes: #57