From 23c4f5600a38c7ff8f3053d11dcf2766cdd92d2f Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Mon, 12 Sep 2016 21:34:23 -0700 Subject: [PATCH] fix(cli) prevent xpcall handler to crash serf_signals.stop() would eventually crash and prevent execution of the following code, thus we would not report the actual crashing reason to the user (silent kong start failure) --- kong/cmd/start.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kong/cmd/start.lua b/kong/cmd/start.lua index d3fa6241d44f..b5bb1880470e 100644 --- a/kong/cmd/start.lua +++ b/kong/cmd/start.lua @@ -14,8 +14,8 @@ local function execute(args) local dao = DAOFactory(conf) local err xpcall(function() - assert(dao:run_migrations()) assert(prefix_handler.prepare_prefix(conf, args.nginx_conf)) + assert(dao:run_migrations()) if conf.dnsmasq then assert(dnsmasq_signals.start(conf)) end @@ -24,10 +24,10 @@ local function execute(args) log("Kong started") end, function(e) log.verbose("could not start Kong, stopping services") - nginx_signals.stop(conf) - serf_signals.stop(conf, dao) + pcall(nginx_signals.stop(conf)) + pcall(serf_signals.stop(conf, dao)) if conf.dnsmasq then - dnsmasq_signals.stop(conf) + pcall(dnsmasq_signals.stop(conf)) end err = e -- cannot throw from this function log.verbose("stopped services")