On Sunday, May 7, 2017 at 12:32:08 AM UTC+2, [email protected] wrote:
>
> I occasionally see things like this in the log, but this simply kills the 
> app. This does not return nicely formatted JSON, which just happens to lack 
> the right data. 
>
> It does, however, stall, for a very long time, sometimes 20 or 30 minutes. 
>
> [...]
>

This part looks like a simple case of a memory leak. Your code (or some 
library you use) is creating objects, but not releasing them, and at a 
certain point it time, your process is out of memory. 

That is relatively simple to debug. Install the heapdump module 
(https://www.npmjs.com/package/heapdump or something similar), and then 
dump the memory maybe once each hour. Something like this in your main 
script.

const heapdump = require('heapdump');
setTimeout(function() {
  heapdump.writeSnapshot(`/tmp/${process.env.pid}${Date.now()}.heapsnapshot`);
}, 60 * 60 * 1000);
// ... the rest of your code.


Then load up the dumps into Chrome's Javascript console (Dev Console -> 
Profiles) and see what kind of objects are you accumulating or not 
releasing).

(Make sure you have enough disk space for all the heap dumps. Also, 
depending how often your app gets stuck, you can dump more or less 
frequently, this is just a basic example.)

On the other hand, it might not be the memory leak, maybe your app is 
specific and simply needs more memory to function properly under load. But 
I'd bet on the mem leak.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/91bf6f7c-8c65-4a4f-a4d9-c58e992761f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to