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

components .found() method could create event emitter memory leak #498

Open
mStirner opened this issue Sep 14, 2024 · 1 comment
Open

components .found() method could create event emitter memory leak #498

mStirner opened this issue Sep 14, 2024 · 1 comment

Comments

@mStirner
Copy link
Member

(node:76125) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 add listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:592:17)
    at EventEmitter.addListener (node:events:610:10)
    at C_DEVICES.found (/home/marc/projects/OpenHaus/backend/system/component/class.component.js:790:21)
    at device (/home/marc/projects/OpenHaus/backend/plugins/cf9e3660-e59e-4b4d-823a-330d4a5dc9b2/index.js:15:23)
    at new Promise (<anonymous>)
    at /home/marc/projects/OpenHaus/backend/plugins/cf9e3660-e59e-4b4d-823a-330d4a5dc9b2/index.js:14:30
    at init (/home/marc/projects/OpenHaus/backend/components/plugins/class.plugin.js:160:33)
    at module.exports (/home/marc/projects/OpenHaus/backend/plugins/cf9e3660-e59e-4b4d-823a-330d4a5dc9b2/index.js:2:12)
    at Plugin.start (/home/marc/projects/OpenHaus/backend/components/plugins/class.plugin.js:181:80)

This is per se not a error/issue.
The more often .found() is used on a component item, the more event listeners are attached to the add event.

How to increase/set the maximal allowed listeners?
Number of Plugins + 2?

Or disable it the warning for the event emitter?

@mStirner
Copy link
Member Author

This is obsolete when plugins run in separate worker threads/child processes.
See #6

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

No branches or pull requests

1 participant