strongloop / strong-pm

deployer for node applications
http://strong-pm.io
Other
1k stars 71 forks source link

PM crashes when DB is corrupt or missing (should send back error and stay alive) #218

Closed kraman closed 9 years ago

kraman commented 9 years ago
$ slc pm -l 8701 
slc pm: StrongLoop PM v4.1.31 (API v7.0.3) listening on port `8701`
slc pm: control listening on path `/Users/strongloop/testapp/8701/pmctl`
slc pm: listen on 8701, work base is `/Users/strongloop/testapp/8701/.strong-pm`, driver is `direct-driver`
service-manager: handle.findOrCreate: Error: ENOENT, open '/Users/strongloop/testapp/8701/.strong-pm/strong-pm.json'
Error: ENOENT, open '/Users/strongloop/testapp/8701/.strong-pm/strong-pm.json'
  at Error (native)

/usr/local/lib/node_modules/strongloop/node_modules/strong-pm/lib/service-manager.js:299
      res.setHeaders(500, {});
          ^
TypeError: undefined is not a function
  at /usr/local/lib/node_modules/strongloop/node_modules/strong-pm/lib/service-manager.js:299:11
  at /usr/local/lib/node_modules/strongloop/node_modules/loopback-datasource-juggler/lib/scope.js:88:7
  at allCb (/usr/local/lib/node_modules/strongloop/node_modules/loopback-datasource-juggler/lib/dao.js:1339:7)
  at /usr/local/lib/node_modules/strongloop/node_modules/loopback-datasource-juggler/lib/connectors/memory.js:371:7
  at /usr/local/lib/node_modules/strongloop/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
  at process._tickDomainCallback (node.js:381:11)
  at process.<anonymous> (/usr/local/lib/node_modules/strongloop/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/index.js:18:15)
rmg commented 9 years ago

FWIW, that stacktrace shows it is trying to send back an error but crashing in the process.

kraman commented 9 years ago

I think this is an old bug probably caused because arc's internal pm was interfering with standalone-pm and deleting the strong-pm.json DB.

PEBKAC?

sam-github commented 9 years ago

This was happening because .strong-pm directory, including the DB, was being removed by arc, pm should crash when it's DB is removed.