-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Out of memory issue plus weird heapUsed in node 8.1.4, does not occur on 6.11.1 #14402
Comments
I'd be curious to know how large the string that your are trying to parse is? |
370 kb; the The heapUsed is way too large to be real; it's 0xFFFFFFFFFFFDA020, which looks a lot like a 64-bit negative number interpreted as unsigned. |
Is that string something you could share? |
@evanlucas I'm afraid we cannot, but it's actually not a single 370kb string -- rather, that part of the code processes variable length strings, which can be anywhere from several kb to several mb in length. The other machines all crashed at the same part of the code, but while handling different length strings. |
I also noticed a strange behavior since 8.1.4 which still happens on 8.2.0 and 8.2.1 |
@dfleury VM module performance is decreased in 8.1.4 because the decrease is temporarily necessary to fix an important security issue: https://nodejs.org/en/blog/vulnerability/july-2017-security-releases/. We are working with the V8 team to devise a solution that will re-enable snapshot support (which enhances performance of VM) in a secure way (#14171). |
We've seen this now in a completely seperate service, which crashed twice (with errors occuring in different places in the code). Crash 1
Crash 2
This is now three seperate crashes, coming from two different applications and multiple places within the code. |
Install llnode and poke around in the core dumps, perhaps it gives some clues. The second one suggests a lot of dynamic code generation (or perhaps merely lazy code generation at an inopportune time, in which case |
lldb versions 3.8, 4.0 and 5.0 segfault in
The specific function is
|
correction, lldb-3.5 only works to pull up the corefile and display the stack trace. It errors out when trying to examine variables (yes, there are two instances of
|
Non-local core files can be inspected with lldb-3.6, which has the parse error fixed. To examine ubuntu-12.04.5 core files on ubuntu-12.04.5:
|
FYI, since my last reply, the memory behavior and the application throughput has returned to normal. Cpu doubled the usage from 15% to 30%. I'm asking myself if it might go lower in a future Node release or it can be considered the new expected usage. |
I am using mode 8.0 and I had the same issue before on aws using t2.large machine, so, I changed the type of the machine to m4.medium and add "--max-old-space-size=16000" to the node process, it solved my issue. |
I think I'm seeing the same behavior in node v7.10.1 and v8.5.0 with two nested for loops over two 10k elements array. Here is the full code: hcombine.js const fs = require('fs');
function capitalizeFirstLetter(string) {
return string[0].toUpperCase() + string.slice(1);
}
const lines1 = fs.readFileSync(process.argv[2]).toString().split(/(\r?\n)+/).filter(x => ! /^(#|\s*)$/.test(x));
const lines2 = fs.readFileSync(process.argv[3]).toString().split(/(\r?\n)+/).filter(x => ! /^(#|\s*)$/.test(x));
// for (const line1 of lines1) { -- crashed even sooner with the generator version
lines1.forEach(line1 => {
// for (const line2 of lines2) {
lines2.forEach(line2 => {
const line1Cap = capitalizeFirstLetter(line1);
const line2Cap = capitalizeFirstLetter(line2);
const output = line1 + line2 + '\n'
+ line1 + line2Cap + '\n'
+ line1 + '-' + line2 + '\n'
+ line1 + '-' + line2Cap + '\n'
+ line1Cap + line2 + '\n'
+ line1Cap + line2Cap + '\n'
+ line1Cap + '-' + line2 + '\n'
+ line1Cap + '-' + line2Cap
;
console.log(output);
});
console.log('\n');
}); Invoke as: curl -s https://raw.githubusercontent.com/hermitdave/FrequencyWords/master/content/2016/ro/ro_50k.txt | head -10000 | cut -d ' ' -f1 > ro10k.txt
node --max_old_space_size=2000 hcombine.js ro10k.txt ro10k.txt > ro100M.txt The output is
What parameters do I need to pass to Node so it can run this loop? |
I'm fairly confident the As to the "heap out of memory" questions, those are best directed to the help repo. |
verified that the problem does not recur with node-v8.9.1 |
It happen in docker images 8-alpine (node-v8.10.0) Security context: 0x417f56a57c1 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory |
you wrong, cause I'm facing same thing |
We recently attempted to upgrade to node 8.1.4. While testing our service with real data, each of the machines on which the service was deployed started crashing every few hours with an out-of-memory error. We also happened to log the result of
process.memoryUsage()
shortly before the crash on one of these machines, and noticed that the number forheapUsed
seems unrealistic.We downgraded the service to node 6.11.1, while keeping the exact same dependencies, and have not yet encountered any similar crashes. We'd appreciate any insights you may have on what could be causing this, and would be happy to provide any further information you require.
This is the error logged just before the crash:
The result of the
memoryUsage
call mentioned above:The text was updated successfully, but these errors were encountered: