pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

If PM2 is killed, the dump.pm2 file is empty

Open extensionsapp opened this issue 9 years ago • 36 comments

Hello.

~# pm2 start process.json && pm2 save

process.json

{
  "apps" : [{
    "name" : "zal.su",
    "script" : "/home/zal.su/app.js",
    "cwd" : "/home/zal.su",
    "error_file" : "/home/zal.su/log/err.log",
    "out_file" : "/home/zal.su/log/out.log",
    "node_args" : "--max-old-space-size=768",
    "max_memory_restart" : "768M",
    "watch" : true,
    "ignore_watch" : [
      "config",
      "log",
      "node_modules",
      "themes/*/public",
      "themes/.*",
      ".*"
    ],
    "watch_options" : {
      "followSymlinks": false
    },
    "vizion" : false
  }]
}

My log:

2017-04-10 19:30:25: pm2 has been killed by signal, dumping process list before exit...
2017-04-10 19:30:26: Deleting process 1
2017-04-10 19:30:26: Stopping app:zal.su id:1
2017-04-10 19:30:26: App [pm2-logrotate] with id [2] and pid [3817], exited with code [0] via signal [SIGTERM]
2017-04-10 19:30:26: App [zal.su] with id [1] and pid [11334], exited with code [0] via signal [SIGTERM]
2017-04-10 19:30:26: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:2
2017-04-10 19:30:26: App name:pm2-logrotate id:2 online
2017-04-10 19:30:26: pid=11334 msg=process killed
2017-04-10 19:30:26: Deleting process 2
2017-04-10 19:30:26: Stopping app:pm2-logrotate id:2
2017-04-10 19:30:26: App [pm2-logrotate] with id [2] and pid [12030], exited with code [0] via signal [SIGINT]
2017-04-10 19:30:27: pid=12030 msg=process killed
2017-04-10 19:30:27: [PM2] Exited peacefully

I reboot server, and my App zal.su not start.

2017-04-10 22:44:31: ===============================================================================
2017-04-10 22:44:31: --- New PM2 Daemon started ----------------------------------------------------
2017-04-10 22:44:31: Time                 : Mon Apr 10 2017 22:44:31 GMT+0300 (MSK)
2017-04-10 22:44:31: PM2 version          : 2.4.2
2017-04-10 22:44:31: Node.js version      : 6.10.2
2017-04-10 22:44:31: Current arch         : x64
2017-04-10 22:44:31: PM2 home             : /root/.pm2
2017-04-10 22:44:31: PM2 PID file         : /root/.pm2/pm2.pid
2017-04-10 22:44:31: RPC socket file      : /root/.pm2/rpc.sock
2017-04-10 22:44:31: BUS socket file      : /root/.pm2/pub.sock
2017-04-10 22:44:31: Application log path : /root/.pm2/logs
2017-04-10 22:44:31: Process dump file    : /root/.pm2/dump.pm2
2017-04-10 22:44:31: Concurrent actions   : 2
2017-04-10 22:44:31: SIGTERM timeout      : 1600
2017-04-10 22:44:31: ===============================================================================
2017-04-10 22:44:32: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:0
2017-04-10 22:44:32: App name:pm2-logrotate id:0 online

Why did not the application start after reboot?

extensionsapp avatar Apr 10 '17 20:04 extensionsapp

Can you share the service unit file (/etc/systemd/system/pm2.service with systemd) ?

vmarchaud avatar Apr 20 '17 09:04 vmarchaud

cat /etc/systemd/system/pm2-root.service

[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target

[Service]
Type=forking
User=root
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/root/.pm2
PIDFile=/root/.pm2/pm2.pid

ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target

extensionsapp avatar Apr 20 '17 09:04 extensionsapp

The dump does not exists after running pm2 start process.json && pm2 save?

After running this command can you run ll ~/.pm2/dump.pm2?

Unitech avatar Apr 21 '17 14:04 Unitech

# pm2 start process.json && pm2 save
[PM2][WARN] Applications menopo.space not running, starting...
[PM2] App [menopo.space] launched (1 instances)
┌──────────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬──────────┐
│ App name     │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ watching │
├──────────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼──────────┤
│ menopo.space │ 1  │ fork │ 1378 │ online │ 0       │ 0s     │ 50% │ 20.5 MB   │ enabled  │
└──────────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 0%  │ 33.324 MB   │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┘
 Use `pm2 show <id|name>` to get more details about an app
[PM2] Saving current process list...
[PM2] Successfully saved in /root/.pm2/dump.pm2
# ls -l ~/.pm2/dump.pm2
-rw-r--r-- 1 root root 3189 Apr 26 18:28 /root/.pm2/dump.pm2
# pm2 logs
-bash: fork: Cannot allocate memory
# pm2 list
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬──────┬─────────────┐
│ Module        │ version │ target PID │ status │ restart │ cpu  │ memory      │
├───────────────┼─────────┼────────────┼────────┼─────────┼──────┼─────────────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 100% │ 31.711 MB   │
└───────────────┴─────────┴────────────┴────────┴─────────┴──────┴─────────────┘
 Use `pm2 show <id|name>` to get more details about an app

after reboot, my app not start.

# cat .pm2/dump.pm2
[]
# pm2 list
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 0%  │ 32.301 MB   │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┘
 Use `pm2 show <id|name>` to get more details about an app

extensionsapp avatar Apr 26 '17 15:04 extensionsapp

<--- Last few GCs --->

1207491733 ms: Scavenge 17.2 (24.0) -> 16.2 (24.0) MB, 0.5 / 0.0 ms [allocation failure].
1207492861 ms: Scavenge 17.2 (24.0) -> 16.2 (24.0) MB, 0.6 / 0.0 ms [allocation failure].
1207497444 ms: Scavenge 17.2 (24.0) -> 16.2 (24.0) MB, 0.5 / 0.0 ms [allocation failure].
1207500246 ms: Scavenge 17.2 (24.0) -> 16.2 (24.0) MB, 0.6 / 0.0 ms [allocation failure].
1207505179 ms: Scavenge 17.2 (24.0) -> 16.2 (24.0) MB, 0.6 / 0.0 ms [allocation failure].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x20aa14ecfb39 <JS Object>
    1: stringify [native json.js:178] [pc=0x275ddf61c9b7] (this=0x20aa14ec90f9 <a JSON with map 0x1dd74670a0e1>,E=0x33c5ad3ff401 <an Object with map 0x390cd35a4ef9>,F=0x20aa14e04381 <undefined>,S=0x20aa14e04381 <undefined>)
    2: arguments adaptor frame: 1->3
    3: send [/usr/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/pub.js:~38] [pc=0x275ddfb181aa] (this=0x14677e13c649 <a PubSock...

FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
 1: node::Abort() [PM2 v2.4.4: God Daemon (/root/.pm2)]
 2: 0x10c9a4c [PM2 v2.4.4: God Daemon (/root/.pm2)]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 6: v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 7: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 8: v8::internal::IncrementalStringBuilder::Extend() [PM2 v2.4.4: God Daemon (/root/.pm2)]
 9: v8::internal::BasicJsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [PM2 v2.4.4: God Daemon (/root/.pm2)]
10: v8::internal::BasicJsonStringifier::Result v8::internal::BasicJsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [PM2 v2.4.4: God Daemon (/root/.pm2)]
11: v8::internal::BasicJsonStringifier::Result v8::internal::BasicJsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [PM2 v2.4.4: God Daemon (/root/.pm2)]
12: v8::internal::BasicJsonStringifier::Stringify(v8::internal::Handle<v8::internal::Object>) [PM2 v2.4.4: God Daemon (/root/.pm2)]
13: v8::internal::Runtime_BasicJSONStringify(int, v8::internal::Object**, v8::internal::Isolate*) [PM2 v2.4.4: God Daemon (/root/.pm2)]
14: 0x275dde8092a7
2017-05-01 11:50:37: ===============================================================================
2017-05-01 11:50:37: --- New PM2 Daemon started ----------------------------------------------------
2017-05-01 11:50:37: Time                 : Mon May 01 2017 11:50:37 GMT+0300 (MSK)
2017-05-01 11:50:37: PM2 version          : 2.4.4
2017-05-01 11:50:37: Node.js version      : 6.10.2
2017-05-01 11:50:37: Current arch         : x64
2017-05-01 11:50:37: PM2 home             : /root/.pm2
2017-05-01 11:50:37: PM2 PID file         : /root/.pm2/pm2.pid
2017-05-01 11:50:37: RPC socket file      : /root/.pm2/rpc.sock
2017-05-01 11:50:37: BUS socket file      : /root/.pm2/pub.sock
2017-05-01 11:50:37: Application log path : /root/.pm2/logs
2017-05-01 11:50:37: Process dump file    : /root/.pm2/dump.pm2
2017-05-01 11:50:37: Concurrent actions   : 2
2017-05-01 11:50:37: SIGTERM timeout      : 1600
2017-05-01 11:50:37: ===============================================================================
2017-05-01 11:50:38: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:0
2017-05-01 11:50:38: App name:pm2-logrotate id:0 online
2017-05-01 11:50:38: Stopping app:pm2-logrotate id:0
2017-05-01 11:50:38: App [pm2-logrotate] with id [0] and pid [27004], exited with code [0] via signal [SIGINT]
2017-05-01 11:50:38: [HandleExit] PM2 is being killed, stopping restart procedure...
2017-05-01 11:50:38: pid=27004 msg=process killed
2017-05-01 11:50:38: ===============================================================================
2017-05-01 11:50:38: --- Stopping PM2 --------------------------------------------------------------
2017-05-01 11:50:38: Time                 : Mon May 01 2017 11:50:38 GMT+0300 (MSK)
2017-05-01 11:50:38: ===============================================================================
2017-05-01 11:50:38: RPC closed
2017-05-01 11:50:38: PUB closed
2017-05-01 11:50:38: PM2 successfully stopped
2017-05-01 13:46:00: ===============================================================================
2017-05-01 13:46:00: --- New PM2 Daemon started ----------------------------------------------------
2017-05-01 13:46:00: Time                 : Mon May 01 2017 13:46:00 GMT+0300 (MSK)
2017-05-01 13:46:00: PM2 version          : 2.4.4
2017-05-01 13:46:00: Node.js version      : 6.10.2
2017-05-01 13:46:00: Current arch         : x64
2017-05-01 13:46:00: PM2 home             : /root/.pm2
2017-05-01 13:46:00: PM2 PID file         : /root/.pm2/pm2.pid
2017-05-01 13:46:00: RPC socket file      : /root/.pm2/rpc.sock
2017-05-01 13:46:00: BUS socket file      : /root/.pm2/pub.sock
2017-05-01 13:46:00: Application log path : /root/.pm2/logs
2017-05-01 13:46:00: Process dump file    : /root/.pm2/dump.pm2
2017-05-01 13:46:00: Concurrent actions   : 2
2017-05-01 13:46:00: SIGTERM timeout      : 1600
2017-05-01 13:46:00: ===============================================================================
2017-05-01 13:46:00: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:0
2017-05-01 13:46:00: App name:pm2-logrotate id:0 online
cat /root/.pm2/dump.pm2
[...

...]

But if I reboot dump.pm2 empty!

cat /root/.pm2/dump.pm2
[]

pm2 list
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 0%  │ 32.777 MB   │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┘
 Use `pm2 show <id|name>` to get more details about an app

I need websites to be always online! Please do something.

extensionsapp avatar May 01 '17 11:05 extensionsapp

FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory

Unitech avatar May 01 '17 11:05 Unitech

@Unitech There was a splash in the load, memory refused. But why PM2 does not restart the processes? And /root/.pm2/dump.pm2 - empty []?

extensionsapp avatar May 01 '17 11:05 extensionsapp

  1. I have error ENOMEM - OK;
  2. All process stop - OK;
  3. I read file /root/.pm2/dump.pm2 - OK;
  4. I reboot server - OK;
  5. I read file /root/.pm2/dump.pm2 - EMPTY FILE [], Why?
2017-06-12 11:50:31: ========================================================================                                                                                                =======
2017-06-12 11:50:31: --- PM2 global error caught --------------------------------------------                                                                                                -------
2017-06-12 11:50:31: Time                 : Mon Jun 12 2017 11:50:31 GMT+0300 (MSK)
2017-06-12 11:50:31: spawn ENOMEM
2017-06-12 11:50:31: Error: spawn ENOMEM
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at exports.spawn (child_process.js:378:9)
    at /usr/lib/node_modules/pm2/lib/TreeKill.js:33:14
    at buildProcessTree (/usr/lib/node_modules/pm2/lib/TreeKill.js:79:12)
    at module.exports (/usr/lib/node_modules/pm2/lib/TreeKill.js:32:5)
    at Object.God.killProcess (/usr/lib/node_modules/pm2/lib/God/Methods.js:223:7)
    at Object.God.stopProcessId (/usr/lib/node_modules/pm2/lib/God/ActionMethods.js:265:9)
    at Object.God.restartProcessId (/usr/lib/node_modules/pm2/lib/God/ActionMethods.js:362:11                                                                                                )
    at /usr/lib/node_modules/pm2/lib/God/ActionMethods.js:395:20
2017-06-12 11:50:31: ========================================================================                                                                                                =======
2017-06-12 11:50:31: [PM2] Resurrecting PM2
internal/child_process.js:319
    throw errnoException(err, 'spawn');
    ^

Error: spawn ENOMEM
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at exports.spawn (child_process.js:378:9)
    at /usr/lib/node_modules/pm2/lib/TreeKill.js:33:14
    at buildProcessTree (/usr/lib/node_modules/pm2/lib/TreeKill.js:79:12)
    at module.exports (/usr/lib/node_modules/pm2/lib/TreeKill.js:32:5)
    at Object.God.killProcess (/usr/lib/node_modules/pm2/lib/God/Methods.js:223:7)
    at Object.God.stopProcessId (/usr/lib/node_modules/pm2/lib/God/ActionMethods.js:265:9)
    at Object.God.restartProcessId (/usr/lib/node_modules/pm2/lib/God/ActionMethods.js:362:11                                                                                                )
    at /usr/lib/node_modules/pm2/lib/God/ActionMethods.js:395:20
2017-06-12 11:50:31: ========================================================================                                                                                                =======
2017-06-12 11:50:31: --- New PM2 Daemon started ---------------------------------------------                                                                                                -------
2017-06-12 11:50:31: Time                 : Mon Jun 12 2017 11:50:31 GMT+0300 (MSK)
2017-06-12 11:50:31: PM2 version          : 2.4.4
2017-06-12 11:50:31: Node.js version      : 6.10.2
2017-06-12 11:50:31: Current arch         : x64
2017-06-12 11:50:31: PM2 home             : /root/.pm2
2017-06-12 11:50:31: PM2 PID file         : /root/.pm2/pm2.pid
2017-06-12 11:50:31: RPC socket file      : /root/.pm2/rpc.sock
2017-06-12 11:50:31: BUS socket file      : /root/.pm2/pub.sock
2017-06-12 11:50:31: Application log path : /root/.pm2/logs
2017-06-12 11:50:31: Process dump file    : /root/.pm2/dump.pm2
2017-06-12 11:50:31: Concurrent actions   : 2
2017-06-12 11:50:31: SIGTERM timeout      : 1600
2017-06-12 11:50:31: ========================================================================                                                                                                =======
2017-06-12 11:50:32: Starting execution sequence in -fork mode- for app name:pm2-logrotate id                                                                                                :0
2017-06-12 11:50:32: App name:pm2-logrotate id:0 online
2017-06-12 11:50:32: Stopping app:pm2-logrotate id:0
2017-06-12 11:50:32: App [pm2-logrotate] with id [0] and pid [19674], exited with code [0] vi                                                                                                a signal [SIGINT]
2017-06-12 11:50:32: [HandleExit] PM2 is being killed, stopping restart procedure...
2017-06-12 11:50:32: pid=19674 msg=process killed
2017-06-12 11:50:32: ========================================================================                                                                                                =======
2017-06-12 11:50:32: --- Stopping PM2 -------------------------------------------------------                                                                                                -------
2017-06-12 11:50:32: Time                 : Mon Jun 12 2017 11:50:32 GMT+0300 (MSK)
2017-06-12 11:50:32: ========================================================================                                                                                                =======
2017-06-12 11:50:32: RPC closed
2017-06-12 11:50:32: PUB closed
2017-06-12 11:50:32: PM2 successfully stopped

Please, tell me why after the reboot the /root/.pm2/dump.pm2 file becomes empty []?

After reboot I have memory

~# free
             total       used       free     shared    buffers     cached
Mem:       1024416     237764     786652      14168      19252     104068
-/+ buffers/cache:     114444     909972
Swap:            0          0          0

but app`s not start.

extensionsapp avatar Jun 12 '17 14:06 extensionsapp

This is probably the biggest problem with PM2, since I can not be sure that my sites will have 99.99% uptime.

extensionsapp avatar Jun 12 '17 15:06 extensionsapp

2017-07-31 00:00:14: Change detected on path get.js for app test.website.org - restarting
2017-07-31 00:00:14: Stopping app:test.website.org id:12
2017-07-31 00:00:14: App [test.website.org] with id [12] and pid [6444], exited with code [0] via signal [SIGINT]
2017-07-31 00:00:14: pid=6444 msg=process killed
2017-07-31 00:00:14: Starting execution sequence in -fork mode- for app name:test.website.org id:12
2017-07-31 00:00:14: App name:test.website.org id:12 online

<--- Last few GCs --->

4172772419 ms: Scavenge 20.7 (27.0) -> 19.7 (27.0) MB, 1.1 / 0.0 ms [allocation failure].
4172787059 ms: Scavenge 20.7 (27.0) -> 19.7 (27.0) MB, 0.5 / 0.0 ms [allocation failure].
4172800147 ms: Scavenge 20.6 (27.0) -> 19.7 (27.0) MB, 0.9 / 0.0 ms [allocation failure].
4172813613 ms: Scavenge 20.7 (27.0) -> 19.7 (27.0) MB, 1.1 / 0.0 ms [allocation failure].
4172814008 ms: Scavenge 20.7 (27.0) -> 19.8 (27.0) MB, 1.5 / 0.0 ms [allocation failure].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1520f60cfb39 <JS Object>
    1: parse [native json.js:~61] [pc=0x3bd85db7ad21] (this=0x1520f60c90f9 <a JSON with map 0x2037fb90a0e1>,C=0x94d94dfff59 <String[91]: {"type":"axm:monitor","data":{"Loop delay":{"value":"0.52ms","agg_type":"avg","alert":{}}}}>,w=0x1520f6004381 <undefined>)
    2: arguments adaptor frame: 1->2
    3: onread [internal/child_process.js:457] [pc=0x3bd85db3880e] (this=0x24bedbc649d1 <a Pipe with ...

FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
 1: node::Abort() [PM2 v2.4.4: God Daemon (/root/.pm2)]
 2: 0x10c9a4c [PM2 v2.4.4: God Daemon (/root/.pm2)]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 6: v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 7: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [PM2 v2.4.4: God Daemon (/root/.pm2)]
 8: v8::internal::Handle<v8::internal::String> v8::internal::JsonParser<false>::ScanJsonString<true>() [PM2 v2.4.4: God Daemon (/root/.pm2)]
 9: v8::internal::JsonParser<false>::ParseJsonObject() [PM2 v2.4.4: God Daemon (/root/.pm2)]
10: v8::internal::JsonParser<false>::ParseJsonValue() [PM2 v2.4.4: God Daemon (/root/.pm2)]
11: v8::internal::JsonParser<false>::ParseJson() [PM2 v2.4.4: God Daemon (/root/.pm2)]
12: v8::internal::JsonParser<false>::Parse(v8::internal::Handle<v8::internal::String>) [PM2 v2.4.4: God Daemon (/root/.pm2)]
13: v8::internal::Runtime_ParseJson(int, v8::internal::Object**, v8::internal::Isolate*) [PM2 v2.4.4: God Daemon (/root/.pm2)]
14: 0x3bd85d4092a7
2017-07-31 00:00:19: ===============================================================================
2017-07-31 00:00:19: --- New PM2 Daemon started ----------------------------------------------------
2017-07-31 00:00:19: Time                 : Mon Jul 31 2017 00:00:19 GMT+0300 (MSK)
2017-07-31 00:00:19: PM2 version          : 2.4.4
2017-07-31 00:00:19: Node.js version      : 6.10.2
2017-07-31 00:00:19: Current arch         : x64
2017-07-31 00:00:19: PM2 home             : /root/.pm2
2017-07-31 00:00:19: PM2 PID file         : /root/.pm2/pm2.pid
2017-07-31 00:00:19: RPC socket file      : /root/.pm2/rpc.sock
2017-07-31 00:00:19: BUS socket file      : /root/.pm2/pub.sock
2017-07-31 00:00:19: Application log path : /root/.pm2/logs
2017-07-31 00:00:19: Process dump file    : /root/.pm2/dump.pm2
2017-07-31 00:00:19: Concurrent actions   : 2
2017-07-31 00:00:19: SIGTERM timeout      : 1600
2017-07-31 00:00:19: ===============================================================================
2017-07-31 00:00:19: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:0
2017-07-31 00:00:19: App name:pm2-logrotate id:0 online
2017-07-31 00:00:19: Stopping app:pm2-logrotate id:0
2017-07-31 00:00:19: App [pm2-logrotate] with id [0] and pid [6545], exited with code [0] via signal [SIGINT]
2017-07-31 00:00:19: [HandleExit] PM2 is being killed, stopping restart procedure...
2017-07-31 00:00:19: pid=6545 msg=process killed
2017-07-31 00:00:19: ===============================================================================
2017-07-31 00:00:19: --- Stopping PM2 --------------------------------------------------------------
2017-07-31 00:00:19: Time                 : Mon Jul 31 2017 00:00:19 GMT+0300 (MSK)
2017-07-31 00:00:19: ===============================================================================
2017-07-31 00:00:19: RPC closed
2017-07-31 00:00:19: PUB closed
2017-07-31 00:00:19: PM2 successfully stopped
2017-07-31 00:01:43: ===============================================================================
2017-07-31 00:01:43: --- New PM2 Daemon started ----------------------------------------------------
2017-07-31 00:01:43: Time                 : Mon Jul 31 2017 00:01:43 GMT+0300 (MSK)
2017-07-31 00:01:43: PM2 version          : 2.4.4
2017-07-31 00:01:43: Node.js version      : 6.10.2
2017-07-31 00:01:43: Current arch         : x64
2017-07-31 00:01:43: PM2 home             : /root/.pm2
2017-07-31 00:01:43: PM2 PID file         : /root/.pm2/pm2.pid
2017-07-31 00:01:43: RPC socket file      : /root/.pm2/rpc.sock
2017-07-31 00:01:43: BUS socket file      : /root/.pm2/pub.sock
2017-07-31 00:01:43: Application log path : /root/.pm2/logs
2017-07-31 00:01:43: Process dump file    : /root/.pm2/dump.pm2
2017-07-31 00:01:43: Concurrent actions   : 2
2017-07-31 00:01:43: SIGTERM timeout      : 1600
2017-07-31 00:01:43: ===============================================================================
2017-07-31 00:01:43: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:0
2017-07-31 00:01:43: App name:pm2-logrotate id:0 online

Add automatic start sites after the fall.

extensionsapp avatar Jul 30 '17 21:07 extensionsapp

Please correct one single problem.

!!!Do not clear the dump file after rebooting the server!!!

If I have error "Error: spawn ENOMEM", my dump file:

~# cat /root/.pm2/dump.pm2
[ {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
},   {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
}
...
]

After reboot:

~# cat /root/.pm2/dump.pm2
[]

Why is it empty []?

extensionsapp avatar Sep 24 '17 19:09 extensionsapp

@Unitech, @vmarchaud please, read my message, step-by-step.

  1. Start all process and pm2 save;
  2. In a few hours ERROR: spawn ENOMEM or process out of memory;
~# pm2 list
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┬──────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │ user │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┼──────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 0%  │ 37.957 MB   │ root │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┴──────┘
 Use `pm2 show <id|name>` to get more details about an app

~# cat /root/.pm2/dump.pm2
[ {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
},   {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
}
...
]
  1. cp /root/.pm2/dump.pm2 /root/.pm2/dump2.pm2
  2. reboot
~# pm2 list
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┬──────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │ user │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┼──────┤
│ pm2-logrotate │ 2.2.0   │ N/A        │ online │ 0       │ 0%  │ 37.957 MB   │ root │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┴──────┘
 Use `pm2 show <id|name>` to get more details about an app

~# cat /root/.pm2/dump.pm2
[]

dump2 > dump. cp /root/.pm2/dump2.pm2 /root/.pm2/dump.pm2 resurrect. pm2 resurrect

[PM2] Resurrecting
[PM2] Restoring processes located in /root/.pm2/dump.pm2
[PM2] Process /test1/app.js restored
[PM2] Process /test2/app.js restored
[PM2] Process /test3/app.js restored
[PM2] Process /test4/app.js restored
[PM2] Process /test5/app.js restored
[PM2] Process /test6/app.js restored
[PM2] Process /test7/app.js restored
[PM2] Process /test8/app.js restored
[PM2] Process /test9/app.js restored
[PM2] Process /test10/app.js restored
...
NICE
~# cat /root/.pm2/dump.pm2
[ {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
},   {
    "instance_var": "NODE_APP_INSTANCE",
    "exec_mode": "fork_mode",
    "env": {
    ...
}
...
]

Why is it empty [] dump after reboot?

extensionsapp avatar Sep 26 '17 12:09 extensionsapp

Steps to reproduce:

systemctl start pm2-node.service
pm2 start someapp
pm2 save

Now dump.pm2 is okay. Then kill pm2:

sudo kill -9 $(pgrep PM2)

Now dump.pm2 is empty and the process list is lost, no way to resurrect. That's insane and totally makes pm2 unreliable!

radkodinev avatar Oct 22 '17 17:10 radkodinev

@radkodinev @extensionsapp Hello guys! Did you solve problem ? i've shocked about exist it and i faced it with it too.

denisenkoaj avatar Feb 21 '18 21:02 denisenkoaj

I've tried to set flag +i for dump file, it is solve problem , but i have next - i use keymetrics monitoring service, and if file have +i flag - keymetrics cannot write to it and cannot monitoring my server. It's problem if you use this service.

denisenkoaj avatar Feb 21 '18 21:02 denisenkoaj

will be fixed via: https://github.com/Unitech/pm2/pull/3510

Unitech avatar Mar 02 '18 14:03 Unitech

If you want to get the fix now you can use the dev branch:

$ npm install Unitech/pm2#development -g

Unitech avatar Apr 09 '18 09:04 Unitech

@Unitech

If you want to get the fix now you can use the dev branch:

$ npm install Unitech/pm2#development -g

it seems the problem is still here.

image image

shixukai avatar Apr 20 '18 12:04 shixukai

I also found this issue.

jazarja avatar May 18 '18 14:05 jazarja

We're also experiencing this. Is this planned to be added soon? Because this is a major bug imo.

dreaganluna avatar Jul 02 '18 12:07 dreaganluna