I am using meteor. I build my app with meteor build
. Then I try to run it with pm2
MONGO_URL=mongodb://localhost:27017/btctestdb PORT=3000 ROOT_URL=http://myurl METEOR_SETTINGS=$(cat /home/app/settings.json) pm2 start main.js &
And I get this error
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
2: 0x12190dc [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
5: v8::internal::Factory::NewStruct(v8::internal::InstanceType) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
6: v8::internal::Factory::NewTuple3(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
7: v8::internal::StoreIC::StoreTransition(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
8: v8::internal::StoreIC::GetMapIndependentHandler(v8::internal::LookupIterator*) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
9: v8::internal::IC::ComputeHandler(v8::internal::LookupIterator*) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
10: v8::internal::StoreIC::UpdateCaches(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::Object::StoreFromKeyed) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
11: v8::internal::StoreIC::Store(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::Object::StoreFromKeyed) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
12: v8::internal::KeyedStoreIC::Store(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
13: v8::internal::Runtime_KeyedStoreIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*) [node /home/app/unbundled/built/p3001/1.10.0/bundle/v1.10.0atp3001.js]
14: 0x299ebe38463d
At first I though it maybe because the new changes in the code base. However I tried the old version but still have the same error.
So now in my pm2 monitoring I can 2 apps running same version. The first one which I ran prior this is fine and working live without any problem. But the second one runs with 100+% CPU How can I fix this, please help.
Running it like this works.
just added --node-args="--max-old-space-size=6144"
MONGO_URL=mongodb://localhost:27017/btctestdb PORT=3000 ROOT_URL=http://app.backtocart.co METEOR_SETTINGS=$(cat /home/app/settings.json) pm2 start main.js --node-args="--max-old-space-size=6144" &