-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli) handle serf shutdown correctly #2375
Conversation
With LuaJIT Lua 5.2 compatibility the error code `256` is not returned from `os.execute`, but instead `code % 255`, and in this case `1`. The comment here says that `If no error is returned` should actually be something like `error returned, serf not running anymore`. This PR fixes the code handling, and usually `serf:leave` is all that needs to be done. This is also related to a patch to `Penlight`: lunarmodules/Penlight/pull/244. Without this PR the Serf Agent `pid` file will not be deleted even if the Serf Agent is not running anymore when using Lua 5.2 compatibility.
Sweet, looking forward to not having to disable Lua 5.2 compat anymore. Am I right to believe this PR only makes sense once lunarmodules/Penlight#244 is merged and released though? |
It will work with and without Penlight |
Indeed. But shouldn't we hold on until re-enabling support for Lua 5.2 compat anyways before merging that, in case it does ever happen? We can mark this PR as ready but leave it open before it needs some other work (it's the goal of the |
I agree, this might not be needed if the serf replacement comes before this, but this would make probably it a bit easier for developers to start working with Kong development (as right now) as all the default OpenRestys come with 5.2 compatibility these days (also might be related to new packaging as well). E.g. I work with macOS and I do |
Sorry, I am not mentioning the removal of Serf, and I too wish to merge this patch prior to the Serf removal. But it seemed to me like this patch is not compatible with our current recommended |
@thibaultcha, well, the thing here is that in my testing all we need to stop Serf is this: local ok, err = serf:leave() The only problem without this patch is that the I have never entered to this block because I guarded it with local code = kill.kill(kong_config.serf_pid, "-15") But I'm not sure if it was there for a reason. So the else block is there just to try The code you are afraid of is this: if code ~= 0 then Yes we could change it to: if code ~= 0 and code ~= 256 then The thing here is that no "if this is perfect" but it sucks badly to leave E.g. Nginx local code = kill.kill(kong_conf.nginx_pid, "-s "..signal)
if code ~= 0 then return nil, "could not send signal" end But here it doesn't matter because we don't really care the Also for I think we should not worry about that |
Just curious, do we care now that 0.11 is out-ish? |
@p0pr0ck5, yes, I don't care this anymore unless we want to have this for 0.10. 0.11 with serf removal will get rid of this as well. |
Btw. The Penlight was released that contains the patches I did send to them. |
so shouldn't this PR be against Also: do we want to reenable the 52 compatibility? and if so, only for |
Good questions. Definitely not in next anymore. I have no strong feelings about it. |
I don't think we need this anymore:
Mind closing this PR thus? |
Summary
With LuaJIT Lua 5.2 compatibility the error code
256
is not returned fromos.execute
, but insteadcode % 256
, and in this case0
.This PR fixes the code handling, and usually
serf:leave
is all that needs to be done. This is also related to a patch toPenlight
. Without this PR the Serf Agentpid
file will not be deleted even if the Serf Agent is not running anymore when using Lua 5.2 compatibility.Related Pull-Requests
Related Fix lunarmodules/Penlight/pull/244