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

Investigate possible EventEmitter memory leak #3569

Closed
dadepo opened this issue Jan 4, 2022 · 1 comment · Fixed by #4421 or #4512
Closed

Investigate possible EventEmitter memory leak #3569

dadepo opened this issue Jan 4, 2022 · 1 comment · Fixed by #4421 or #4512
Assignees
Labels
prio-high Resolve issues as soon as possible. scope-logging Issue about logs: hygiene, format issues, improvements.

Comments

@dadepo
Copy link
Contributor

dadepo commented Jan 4, 2022

Describe the bug

While trying to run lodestar on local testnet following the documentation here, I ran into complications which led to me to create this issue here.

Part of what I noticed, while trying to get Lodestar running in the logs was this error:

(node:15159) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 chainHead listeners added to [ValidatorEventEmitter]. Use emitter.setMaxListeners() to increase limit

On a quick investigation, the issue seems to be coming from this part of the code.

Two promises are being raced. One of the promises this.waitForBlockSlot(slot), sets event listeners. As can be seen here.

On my local, it seems the promise with the event listener never wins this race, and never is the one that gets resolved, hence the listener is never removed, hence leads to the the warning message that pops up in the log.

Expected behavior

Preferably not have the EventEmitter memory leak warning.

Hence:

  • Confirm if this is indeed an issue
  • Confirm if this can only practically show up in the local testnet - hence severity will be low
  • If need be, see how this can be resolved.
@philknows philknows added the scope-memory Issues to reduce and improve memory usage. label Jan 24, 2022
@dapplion dapplion added the prio-low This is nice to have. label Feb 4, 2022
@dapplion dapplion added prio-high Resolve issues as soon as possible. and removed prio-low This is nice to have. labels Aug 13, 2022
@dapplion
Copy link
Contributor

Marking as high as we should start taking very seriously our log hygiene if we want any adoption.

Lodestar logging

(node:15159) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 chainHead listeners added to [ValidatorEventEmitter]. Use emitter.setMaxListeners() to increase limit

IS NOT ACCEPTABLE, Either use https://nodejs.org/api/events.html#emittersetmaxlistenersn or change to a different pattern

@dapplion dapplion added scope-logging Issue about logs: hygiene, format issues, improvements. and removed scope-memory Issues to reduce and improve memory usage. labels Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio-high Resolve issues as soon as possible. scope-logging Issue about logs: hygiene, format issues, improvements.
Projects
None yet
3 participants