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

MaxListenersExceededWarning: Possible EventEmitter memory leak detected #139

Open
marcelblum opened this issue Nov 9, 2022 · 0 comments

Comments

@marcelblum
Copy link

If remote is in use in the renderer and the page is reloaded >10 times (via location.reload() or webContents.reload()), the following scary sounding warning appears in the Node console:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 render-view-deleted listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit

Took me a while to trace it to this package but I was able to isolate and confirm. Happens since at least Electron 15 all the way through latest v21, on Win and Mac. Basically if you run this code in a renderer 10 times:

console.log(require('@electron/remote').app.getPath('exe'));
location.reload();

the warning is thrown. Looks like merely doing require('@electron/remote') alone won't trigger the warning but actually accessing any object through remote will. I wonder if there is some cleanup that's not being done on page reloads? I know the docs say to make sure to clean up interprocess references when using remote, but something as simple as require('@electron/remote').app.getPath('exe') isn't even creating a persistent reference so I'm not sure what I could be doing wrong.

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