-
Notifications
You must be signed in to change notification settings - Fork 286
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
Memory leak:- ark-forger process. #2326
Comments
Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on. If no reviewer appears after a week, a reminder will be sent out. |
Thanks for the report @alessiodf and providing the patch core. We are testing this already, as we want to narrow it down to exact cause/version/setup. So we will get back on this soon. |
The exact cause was described in the patch comment:
As a further demonstration, I've attached an extremely crude script that will cause Brian to have an aneurysm if he reads the source, but it demonstrates the memory leak in the existing approach versus the refactored design as it prints the heap memory usage after manually running the garbage collector. Run it with With 5000 repetitions:
With 10000 repetitions:
With 50000 repetitions:
A couple of extreme examples using the non-leaky version:
As you will see, the memory usage in the non-leaky version barely rises as the number of repetitions increases and eventually caps out at 3.7MB regardless of the number of further repetitions, whereas the leaky version continually uses more memory as the number of repetitions grows, which demonstrates that the forger process will leak each time the loop executes (i.e. once every ~8 seconds). Over many days, weeks and months, this leak will become very substantial as indicated by kolap's mem usage. |
💯 yes. Nice detailed explanation. Also looks like related to node v10.x.x. As node v11 behaves much better on this. |
The tests above were node v10. Running v11 now: Using promise recursion:
Using normal loop:
Using promise recursion:
Using normal loop:
So it still leaks in v11 (even if not as much, it still does leak which will accumulate over days/weeks/months), whereas the normal loop does not leak at all. |
This issue has been closed. If you wish to re-open it please provide additional information. |
Describe the bug
Multiple users have reported that the ark-forger process shows signs of a memory leak. A delegate's ark-forger was using 1.4GB of memory upon checking as shown below...
ark@gnia:~$ pm2 status
┌────────────┬────┬──────┬────────┬───┬───────┬────────────┐
│ Name │ id │ mode │ status │ ↺ │ cpu │ memory │
├────────────┼────┼──────┼────────┼───┼───────┼────────────┤
│ ark-forger │ 2 │ fork │ online │ 0 │ 3% │ 1.4 GB │
│ ark-relay │ 1 │ fork │ online │ 0 │ 14.9% │ 374.1 MB │
└────────────┴────┴──────┴────────┴───┴───────┴────────────
To Reproduce
Steps to reproduce the behavior:
Expected behavior
For the ark-forger process to be using significantly less than 1.4GB of memory.
Screenshots
Server (please complete the following information):
However, this issue has been reported by multiple users with various versions of operating system& system specs.
Additional context
Delegate alessio // fun has created a patch file for this issue which he will send to me. Once received, I shall forward it to the dev team for review.
The text was updated successfully, but these errors were encountered: