-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "refactor(cmd): use resty.signal for process signaling (#11382)…
…" (#11620) This reverts commit bbdda0b. For posterity's sake, there are actually _two_ reasons for us to merge this: 1. commit history cleanup (as noted in the PR desc for #11620) 2. we discovered a subtle bug in the way that `resty.signal` traverses `LUA_CPATH` in order to discover and load its shared object dependency ([link](https://github.com/openresty/lua-resty-signal/blob/7834226610e2df36f8e69641c4ca0d5ea75a9535/lib/resty/signal.lua#L21-L58)) and _need_ to revert this to un-break master
- Loading branch information
1 parent
e0d53a8
commit bfc8ef7
Showing
14 changed files
with
134 additions
and
727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
local pl_path = require "pl.path" | ||
local pl_utils = require "pl.utils" | ||
local log = require "kong.cmd.utils.log" | ||
|
||
local cmd_tmpl = [[kill %s `cat %s 2>&1` >/dev/null 2>&1]] | ||
|
||
local function kill(pid_file, args) | ||
log.debug("sending signal to pid at: %s", pid_file) | ||
local cmd = string.format(cmd_tmpl, args or "-0", pid_file) | ||
if pl_path.exists(pid_file) then | ||
log.debug(cmd) | ||
local _, code = pl_utils.execute(cmd) | ||
return code | ||
else | ||
log.debug("no pid file at: %s", pid_file) | ||
return 0 | ||
end | ||
end | ||
|
||
local function is_running(pid_file) | ||
-- we do our own pid_file exists check here because | ||
-- we want to return `nil` in case of NOT running, | ||
-- and not `0` like `kill` would return. | ||
if pl_path.exists(pid_file) then | ||
return kill(pid_file) == 0 | ||
end | ||
end | ||
|
||
return { | ||
kill = kill, | ||
is_running = is_running | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
bfc8ef7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:bfc8ef79c8496bf025315ec9d014ba7cb915b4eb
Artifacts available https://github.com/Kong/kong/actions/runs/6252950017