Skip to content

bug: plugin limit-conn will keep rejecting the requests in some condition #11868

@wklken

Description

@wklken

Current Behavior

https://github.com/apache/apisix/blob/master/apisix/plugins/limit-conn.lua#L84-L91

function _M.access(conf, ctx)
    return limit_conn.increase(conf, ctx)
end


function _M.log(conf, ctx)
    return limit_conn.decrease(conf, ctx)
end

if the request is interrupt in phase access of other plugins like

function _M.access(conf, ctx)
    return 500
end

the log phase would not be executed, then the value of limiting is keep increasing and never decrease; and all the following requests would be rejected.

the data is in shared_dict, so can't reset it via apisix reload

Expected Behavior

decrease the value

Error Logs

No response

Steps to Reproduce

  1. enable limit-conn
  2. enable another plugin to return 500 in access

Environment

  • APISIX version (run apisix version): 3.2
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginwait for updatewait for the author's response in this issue/PR

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions