'Meteor is crashing on the smallest DigitalOcean Droplet (out of memory: Kill process ...)

I am running simple Meteor app on basic (512GB) DigitalOcean droplet. Once in a while Meteor simply crashes with this error message:

enter image description here

Out of memory: Kill process 9682 (node) ...
...
=> Exited from signal: SIGKILL
FATAL ERROR: JS Allocation failed - process out of memory

What is wrong? This is really simple app and it could not spend all the memory.



Solution 1:[1]

I was able to fix this issue by using more swap space than initially specified (more than 256mb) to 1GB.

To resize your swap space on Ubuntu to 1Gb:

sudo swapoff -a

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

sudo mkswap /swapfile

sudo swapon /swapfile

Solution 2:[2]

You can try setting up a swap file for your DigitalOcean droplet.

DigitalOcean made an excellent guide on how to do this. You can find it here:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

Solution 3:[3]

I found the problem.

https://github.com/joyent/node/wiki/FAQ#what-is-the-memory-limit-on-a-node-process

I used only 512mb of RAM for 64-bit system. But this is not recommended for node process.

Solution 4:[4]

I believe it may be related to an issue meteor may be having. Check out the comment showing the cpu usage in this github issue. https://github.com/meteor/meteor/issues/2536#issuecomment-55295490

Solution 5:[5]

In response to Marek's answer,

I'm running a Meanjs app on Digital Ocean and while everything worked fine locally and when I tested my live app alone, as soon as a second user logged on it would run out of memory and crash.

Instead of trying the whole swap thing, I just upgraded from $5/mo for 512mb of RAM to $10/mo with 1G and so far I've got it up to 6 machines with multiple Chrome and Firefox browsers accessing it simultaneously just fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Milean
Solution 2
Solution 3 Marek
Solution 4 Chad_Martinson
Solution 5 gravmod64