Skip to content

Commit

Permalink
fix(cli) prevent xpcall handler to crash
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
thibaultcha committed Sep 13, 2016
1 parent a6301dd commit 23c4f56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kong/cmd/start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit 23c4f56

Please sign in to comment.