Skip to content

Commit 28f5d10

Browse files
committed
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)
1 parent ab91803 commit 28f5d10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kong/cmd/start.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ local function execute(args)
1414
local dao = DAOFactory(conf)
1515
local err
1616
xpcall(function()
17-
assert(dao:run_migrations())
1817
assert(prefix_handler.prepare_prefix(conf, args.nginx_conf))
18+
assert(dao:run_migrations())
1919
if conf.dnsmasq then
2020
assert(dnsmasq_signals.start(conf))
2121
end
@@ -24,10 +24,10 @@ local function execute(args)
2424
log("Kong started")
2525
end, function(e)
2626
log.verbose("could not start Kong, stopping services")
27-
nginx_signals.stop(conf)
28-
serf_signals.stop(conf, dao)
27+
pcall(nginx_signals.stop(conf))
28+
pcall(serf_signals.stop(conf, dao))
2929
if conf.dnsmasq then
30-
dnsmasq_signals.stop(conf)
30+
pcall(dnsmasq_signals.stop(conf))
3131
end
3232
err = e -- cannot throw from this function
3333
log.verbose("stopped services")

0 commit comments

Comments
 (0)