Reputation: 2290
I have some DigitalOcean droplet with small amount of RAM, but there I should to host a lot of pm2 processes (to be more accurate, 9 - 8 in cluster mode (with provided -i 0
) and 1 in fork mode). These processes are NodeJS Express servers that do server-side rendering for React.js projects.
So, as expected, sometimes pm2 is crashing because there is not enough RAM, and after it crashing it obviously does not restore all processes despite of there is startup daemon enabled.
I know, that startup daemon works only on system starts, so now every time when pm2 crashes, I should manually go to the droplet and reboot the system on it.
Is there any workarounds to automate this process? Or, maybe there exist some pm2 daemon that works when pm2 starts?
Appreciate any help!
Thanks in advance!
Here is the last crash log (the part, that is related to crash manually):
<--- Last few GCs --->
[11194:0x3184710] 38854201 ms: Scavenge 24.7 (28.2) -> 23.8 (28.2) MB, 0.5 / 0.0 ms allocation failure
[11194:0x3184710] 38888980 ms: Scavenge 24.8 (28.2) -> 23.9 (28.7) MB, 0.7 / 0.0 ms allocation failure
[11194:0x3184710] 39006864 ms: Scavenge 24.8 (28.7) -> 23.9 (28.7) MB, 0.7 / 0.0 ms allocation failure
[11194:0x3184710] 39131478 ms: Scavenge 24.8 (28.7) -> 23.9 (28.7) MB, 0.4 / 0.0 ms allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0xa90e93a5879 <JSObject>
0: builtin exit frame: parse(this=0xa90e93890a9 <Object map = 0x188eb7f82ba1>,0x33a45597fe41 <String[338]: {"type":"axm:monitor","data":{"Loop delay":{"value":"0.81ms","ag$
FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
1: node::Abort() [node /home/<private path>/frontend/dist-server/server.bundle.js]
2: 0x8c20ec [node /home/<private path>/frontend/dist-server/server.bundle.js]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node /home/<private path>/frontend/dist-server/server.bundle.js]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node /home/<private path>/frontend/dist-server/server.bundle.js]
5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node /home/<private path>/frontend/dist-server/server.bundle$
6: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node /home/<private path>/fronte$
7: v8::internal::Factory::NewJSObject(v8::internal::Handle<v8::internal::JSFunction>, v8::internal::PretenureFlag) [node /home/<private path>/frontend/dist-server$
8: v8::internal::JsonParser<true>::ParseJsonObject() [node /home/<private path>/frontend/dist-server/server.bundle.js]
9: v8::internal::JsonParser<true>::ParseJsonValue() [node /home/<private path>/frontend/dist-server/server.bundle.js]
10: v8::internal::JsonParser<true>::ParseJson() [node /home/<private path>/frontend/dist-server/server.bundle.js]
11: v8::internal::Builtin_JsonParse(int, v8::internal::Object**, v8::internal::Isolate*) [node /home/<private path>/frontend/dist-server/server.bundle.js]
12: 0x1d7ee3e8697d
Upvotes: 0
Views: 3336