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

[Question] MaxListenersExceededWarning: Possible EventEmitter memory leak detected. #4776

Closed
paperbackdragon opened this issue Dec 19, 2020 · 2 comments · Fixed by #5283
Closed
Assignees

Comments

@paperbackdragon
Copy link

paperbackdragon commented Dec 19, 2020

I'm in the process of moving our tests from puppeteer to playwright, and when I run them now I notice a warning in the output:

> jest --runInBand --config=./jest-playwright.config.js

 PASS  src/playwright/commands/sync-commands.test.ts (25.332s)
 PASS  src/playwright/list/list-scroll.test.ts (16.498s)
 PASS  src/playwright/notifications/notifications.test.ts (8.894s)
 PASS  src/playwright/driveStatus/drive-status-update.test.ts (8.239s)
 PASS  src/playwright/commands/view-online.test.ts (8.386s)
 PASS  src/playwright/driveStatus/drive-callout.test.ts (6.712s)
 PASS  src/playwright/commands/delete.test.ts (6.422s)
 PASS  src/playwright/settings/sync-settings-account.test.ts
 PASS  src/playwright/rootView/root-view.test.ts
 PASS  src/playwright/settings/sync-settings-general.test.ts
(node:38312) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnected listeners added. Use emitter.setMaxListeners() to increase limit
 PASS  src/playwright/commands/rename.test.ts
 PASS  src/playwright/driveStatus/drive-status-button.test.ts
 PASS  src/playwright/commands/new-folder.test.ts

It always seems to be after the 10th test suite that runs so I'm assuming it has to do with the browser process. I'm using chromium.launchServer in a Jest setup script, setting that websocket endpoint to a variable in process.env, and then using const browser = chromium.connect({ wsEndpoint: process.env.WS_ENDPOINT }); in each test to get a reference to the one browser instance. I'm making sure to call page.close() after each test suite, and browser.close() in my Jest teardown script.

Is this pattern not using just one browser instance? Or would the issue be something else? I'm happy to just set process.setMaxListeners(Infinity); but I want to be sure that's safe to do.

Thanks!!

@dennis8989
Copy link

I have the same issue. I use playwright-python, I wonder how to add process.setMaxListeners(Infinity) in my code? or it has been fixed in version 1.12? Thanks

@mxschmitt
Copy link
Member

Which version are you using? I would recommend creating a new issue with reproducible steps. Because closed issues don't get normally much attention.

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

Successfully merging a pull request may close this issue.

6 participants