-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
graceful reload: kong reload on a machine with reasonable traffic and a go plugin leads to 404 and DOS #8531
Comments
It seems I am able to "fix" the big 404 issue by resetting the plugin instance: diff --git a/kong/runloop/plugin_servers/pb_rpc.lua b/kong/runloop/plugin_servers/pb_rpc.lua
index 38f3aafe7..ae4531cdd 100644
--- a/kong/runloop/plugin_servers/pb_rpc.lua
+++ b/kong/runloop/plugin_servers/pb_rpc.lua
@@ -396,7 +396,7 @@ function Rpc:handle_event(plugin_name, conf, phase)
if not res then
kong.log.err(err)
- if string.match(err:lower(), "no plugin instance") then
+ if string.match(err:lower(), "no plugin instance") or err:lower() == "closed" then
self.reset_instance(plugin_name, conf)
return self:handle_event(plugin_name, conf, phase)
end But still the reload is not graceful - at least only 3 requests fail due to
|
I think we're hitting this on kong version 2.8.0. Slightly different line number:
https://github.com/Kong/kong/blob/master/kong/runloop/plugin_servers/pb_rpc.lua#L397 |
...still testing.... kong reached the following state, after continuous reloading under load, with the above patch
So there are now a couple of plugin processes hanging around... all but one lost their worker process. |
I created https://github.com/bettermarks/kong_8531 to easy reproduce this issue. Also interesting - JavaScript plugins fail even worse, while Python plugins seem to repair itself and nearly do not mess up. The |
When we exit or reload kong, plugin servers are quiting because they encounter error in socket. This behavior is not proper. We not close with SIGTERM when possible. Hopefully this can be a fix to #8531
* fix(language) plugin server graceful shutdown When we exit or reload kong, plugin servers are quiting because they encounter error in socket. This behavior is not proper. We not close with SIGTERM when possible. Hopefully this can be a fix to #8531
Fixed by #8923 |
I got the same issue but don't know how to fixed it. I use the latest version of go pdk. How did you solve it? |
…c and a go plugin leads to 404 and DOS Kong#8531 - v2.8.x
Is there an existing issue for this?
Kong version (
$ kong version
)2.7.1
Current Behavior
When just reloading kong while the host receives reasonable traffic passed through a go plugin, all responses after reload have a
status==404
rendering the service useless.The error log shows:
Expected Behavior
kong reloads gracefully without notice to a client.
Steps To Reproduce
Anything else?
We believe, this is related to how kong is managing recreating its workers and the go plugin process, e.g. binding new workers to the old plugin process and stopping it the latter.
The text was updated successfully, but these errors were encountered: