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

Resource leak in validator client #4087

Closed
dapplion opened this issue May 31, 2022 · 2 comments · Fixed by #4107
Closed

Resource leak in validator client #4087

dapplion opened this issue May 31, 2022 · 2 comments · Fixed by #4107
Labels
prio-high Resolve issues as soon as possible.

Comments

@dapplion
Copy link
Contributor

Describe the bug

Something is leaking resources in the validator client, both in memory and CPU. This has been observed in the past month too but a much lower scale. This capture is from Ropsten nodes, post-genesis pre-merge

Screenshot from 2022-05-31 08-51-02

@dapplion dapplion added the prio-high Resolve issues as soon as possible. label May 31, 2022
@dapplion
Copy link
Contributor Author

dapplion commented Jun 2, 2022

Managed to capture two CPU profiles at start and at a higher value:

Screenshot from 2022-06-02 22-43-01

Profile 1 Heavy (bottom-up) (CPU 2%)

Screenshot from 2022-06-02 22-47-09

Profile 2 Heavy (bottom-up) (CPU 6%)

Screenshot from 2022-06-02 22-47-37

Heap-snapshot 1 (CPU 2%)

Screenshot from 2022-06-02 22-53-59

Heap-snapshot 2 (CPU 6%)

Screenshot from 2022-06-02 23-08-03

Summary

So this most likely looks like a leak and improper handling of signals in the lodestar-api client request function.

  • CPU increase caused by EventTarget adding and removing listeners
  • Memory increase caused by many EventTarget and AbortController (78,000).

@dapplion
Copy link
Contributor Author

dapplion commented Jun 3, 2022

Looks like the leak is caused here, where the callback being un-subscribed is not the same as the one being subscribed

Adds () => controller.abort(), removes controller.abort

signalGlobal.addEventListener("abort", () => controller.abort());

signalGlobal.removeEventListener("abort", controller.abort);

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant