-
Notifications
You must be signed in to change notification settings - Fork 284
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
FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory #2698
Comments
I have a similar setup and a similar problem. Up to 64 workers hammering a pg db with huge await loops. Set all possible mem adjustments to 256GB, with no luck. When the processes crash (with almost identical error) they just use around 36GB (all). Machine has 512GB. Solved (for me): My mistake was when I got OOM I blindly increased all limits, ignoring the mechanism for heap alloc. NewSpace or YoungGen should not be increased. Newly allocated chunks just blow the mem available. |
Yes I found a solution, actually that was not a NodeJS bug, it was a problem with the OS, in the virtual memory mapping of linux there is a maximum memory allocation, you can increase it with |
@drouarb |
For me, this fix worked, this was not a pure nodejs error, but an error related to v8 failling to allocating more memory due to the kernel virtual memory map being full. This command will tell your kernel to increase the kernel virtual memory map and allow more malloc() |
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. |
It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. |
v14.2.0 (also tried in v13.8.0)
Ubuntu 18.04 Server
Runtime
Typescript, sequelize, node-pg (all lastest)
I'm running a script, doing heavy data-processing in worker-threads, it runs until node crash with the following error:
This error appears randomly after few hours of processing.
The worker are on the following architecture:
Here is the end of my log: https://gist.github.com/drouarb/28f3b411a3088bc85bf82e65d0def25d
Is a log I added in a setInterval in the main thread.
Is a log of the memory before and after GC in Workers thread.
I added the following flags to node:
--expose-gc --report-on-fatalerror --report-uncaught-exception --report-on-signal
, that allow me to have a report once node crash.Here is a diagnostic generated with a SIGUSR2 while running:
https://gist.github.com/drouarb/2f919f5152eb44dc569ea1ce6bf4accf
Here is the diagnostic when node crashed:
https://gist.github.com/drouarb/875ac90e074fca3b9b029be5633f1e09
I Converted all sizes to human size.
It appears that my workers disappeared when node generated the last crash.
My workers thread are sending data to the coordination thread with ArrayBuffer which are transfered, could it be a source of the memory leak ?
On crash we see that old_space memorySize have grown, but not the capacity.
Also new_space=>memorySize jumped form 1.05 MB to 33.6 MB, is it normal ?
The main thread, there is nothing happening except the display of a process.memoryUsage()
If it is a worker going out of memory, why don't I have a
ERR_WORKER_OUT_OF_MEMORY
?EDIT 1:
After looking at the report, it appears that the log comes from thread 24 ("threadId": 24 in the Diagnostic Report no 2).
EDIT 2:
I'm running my app again, and logging every 5seconds node Diagnostic Reports to grafana. I hope I will find something intersting.
The text was updated successfully, but these errors were encountered: