kuzzleio / kuzzle

Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
https://kuzzle.io
Apache License 2.0
1.43k stars 123 forks source link

Kuzzle crashes if the plugin init throws an error #796

Closed dbengsch closed 7 years ago

dbengsch commented 7 years ago

If a the plugin init throws an error, Kuzzle tries to trigger a core dump, but the cli controller is not initialized yet. Finally it will crash Kuzzle:

kuzzle_1        | 0|KuzzleSe | ERROR: unhandledRejection: this.context.accessors.registerStrategy is not a function TypeError: this.context.accessors.registerStrategy is not a function
kuzzle_1        | 0|KuzzleSe |     at Strategy.load (/var/app/plugins/available/kuzzle-plugin-auth-passport-local/lib/passport/strategy.js:56:28)
kuzzle_1        | 0|KuzzleSe |     at context.accessors.storage.bootstrap.then.then.then (/var/app/plugins/available/kuzzle-plugin-auth-passport-local/lib/index.js:80:18)
kuzzle_1        | 0|KuzzleSe | From previous event:
kuzzle_1        | 0|KuzzleSe |     at Promise (/var/app/lib/api/core/plugins/pluginsManager.js:139:24)
kuzzle_1        | 0|KuzzleSe | From previous event:
kuzzle_1        | 0|KuzzleSe |     at Object.keys.map (/var/app/lib/api/core/plugins/pluginsManager.js:136:14)
kuzzle_1        | 0|KuzzleSe |     at Array.map (native)
kuzzle_1        | 0|KuzzleSe |     at PluginsManager.pluginRun [as run] (/var/app/lib/api/core/plugins/pluginsManager.js:115:42)
kuzzle_1        | 0|KuzzleSe |     at internalEngine.init.then.then.then.then (/var/app/lib/api/kuzzle.js:122:39)
kuzzle_1        | 0|KuzzleSe |     at tryCallOne (/var/app/node_modules/promise/lib/core.js:37:12)
kuzzle_1        | 0|KuzzleSe |     at /var/app/node_modules/promise/lib/core.js:123:15
kuzzle_1        | 0|KuzzleSe |     at flush (/var/app/node_modules/asap/raw.js:50:29)
kuzzle_1        | 0|KuzzleSe |     at _combinedTickCallback (internal/process/next_tick.js:67:7)
kuzzle_1        | 0|KuzzleSe |     at process._tickDomainCallback (internal/process/next_tick.js:122:9)
kuzzle_1        | 0|KuzzleSe | ERROR: uncaughtException: Cannot read property 'dump' of undefined TypeError: Cannot read property 'dump' of undefined
kuzzle_1        | 0|KuzzleSe |     at process.on (/var/app/lib/api/kuzzle.js:200:33)
kuzzle_1        | 0|KuzzleSe |     at emitTwo (events.js:106:13)
kuzzle_1        | 0|KuzzleSe |     at process.emit (events.js:191:7)
kuzzle_1        | 0|KuzzleSe |     at methodName (/var/app/node_modules/bluebird/js/release/debuggability.js:186:33)
kuzzle_1        | 0|KuzzleSe |     at activeFireEvent (/var/app/node_modules/bluebird/js/release/debuggability.js:229:44)
kuzzle_1        | 0|KuzzleSe |     at fireRejectionEvent (/var/app/node_modules/bluebird/js/release/debuggability.js:614:14)
kuzzle_1        | 0|KuzzleSe |     at Promise._notifyUnhandledRejection (/var/app/node_modules/bluebird/js/release/debuggability.js:61:9)
kuzzle_1        | 0|KuzzleSe |     at Async._drainQueue (/var/app/node_modules/bluebird/js/release/async.js:138:12)
kuzzle_1        | 0|KuzzleSe |     at Async._drainQueues (/var/app/node_modules/bluebird/js/release/async.js:146:10)
kuzzle_1        | 0|KuzzleSe |     at Immediate.Async.drainQueues (/var/app/node_modules/bluebird/js/release/async.js:17:14)
kuzzle_1        | 0|KuzzleSe |     at runCallback (timers.js:637:20)
kuzzle_1        | 0|KuzzleSe |     at tryOnImmediate (timers.js:610:5)
kuzzle_1        | 0|KuzzleSe |     at processImmediate [as _immediateCallback] (timers.js:582:5)
kuzzle_1        | 0|KuzzleSe | /var/app/lib/api/kuzzle.js:210
kuzzle_1        | 0|KuzzleSe |     kuzzle.cliController.actions.dump(request)
kuzzle_1        | 0|KuzzleSe |                                 ^
kuzzle_1        | 0|KuzzleSe | TypeError: Cannot read property 'dump' of undefined
kuzzle_1        | 0|KuzzleSe |     at process.on (/var/app/lib/api/kuzzle.js:210:33)
kuzzle_1        | 0|KuzzleSe |     at emitOne (events.js:96:13)
kuzzle_1        | 0|KuzzleSe |     at process.emit (events.js:188:7)
kuzzle_1        | 0|KuzzleSe |     at process._fatalException (bootstrap_node.js:296:26)
AnthonySendra commented 7 years ago

Can't reproduce. With David, we agree to close.