Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright instances not disposed until end of test run #122

Open
johnboygit opened this issue Mar 16, 2023 · 0 comments
Open

Playwright instances not disposed until end of test run #122

johnboygit opened this issue Mar 16, 2023 · 0 comments

Comments

@johnboygit
Copy link

var playwright = await Microsoft.Playwright.Playwright.CreateAsync();

In my SpecFlow Playwright project (mostly based on this one) I was seeing many node.js instances being created as the test suite ran.

The longer the test suite ran, the more instances that were being created. It wasn't until the end of the test run that they finally got disposed. Kick off a test run and view the Windows Task Manager to see.

I eventually traced the problem down to the line of code referenced above. The Playwright instance being created in the method was not being disposed after each scenario. I ended up modifying the code to expose the Playwright object and then dispose of it in the BrowserDirver.Dispose() method.

This problem was actually crashing our Linux build agent as it just kept running out of memory with masses of node.js instances.

I think this problem would be evident even with the unadulterated code here but perhaps someone could confirm. Hopefully this will save someone some time if they see Playwright memory usage getting out of control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant