-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
bug: the limit-conn plugin has a bug #4556
Comments
That's a known issue, we should avoid running same plugins both in global rules and routes (especially with same configurations). |
Are there any plans to fix this problem? Because some scenarios require global rules to cooperate with routes |
we can consider optimizing the limit key of the limit-req plugin so that the key can be distinguished. |
I'm not sure if we are discussing the same issue, because I am emphasizing the limit-conn plugin, or is this the same type of issue? What is the root cause of this problem? Because I see the source code has a conf_type field to distinguish the global plugin and the plugin on the router. |
My mistake, I meant to say that the three similar plugins of limit-* |
@zuiyangqingzhou you can make a try with this patch. diff --git a/apisix/plugins/limit-conn.lua b/apisix/plugins/limit-conn.lua
index 564a1b54c..dc8d22c44 100644
--- a/apisix/plugins/limit-conn.lua
+++ b/apisix/plugins/limit-conn.lua
@@ -129,6 +129,7 @@ function _M.log(conf, ctx)
end
core.tablepool.release("plugin#limit-conn", limit_conn)
+ ctx.limit_conn = nil
return
end |
great, verified to solve the current problem. |
Issue description
When the global limit-conn plug-in is enabled, and the limit-conn plug-in is also enabled on a specific route, the limit of the number of concurrent connections will be incorrect.
Environment
Bug report without environment information will be ignored or closed.
apisix version
): 2.6uname -a
): Darwin bogon 20.5.0 Darwin Kernel Version 20.5.0nginx -V
oropenresty -V
): nginx version: openresty/1.19.3.2curl http://127.0.0.1:9090/v1/server_info
to get the info from server-info API): etcd Version: 3.4.16luarocks --version
): /usr/local/bin/luarocks 3.7.0Minimal test code / Steps to reproduce the issue
Bug report without steps to reproduce will be ignored or closed.
limit-conn
on global_rulelimit-conn
ontest
routerzuiyangqingzhou@18d0023#diff-501e2c23c5fcf9e6df8c359429ef4b125e1a7e1abb593316f592df1b1024f97d
What's the actual result? (including assertion message & call stack if applicable)
Only three requests were intercepted, and the rest passed normally,
The recorded log information is as follows
first :
second:
What's the expected result?
I configured the route to limit 3 concurrency, and the global rule limits 5 concurrency. The expected result should be 20 requests, only 3 can pass, and the rest should be restricted.
The text was updated successfully, but these errors were encountered: