janiussyafiq commented on code in PR #13019:
URL: https://github.com/apache/apisix/pull/13019#discussion_r2843904710
##########
apisix/plugins/limit-req.lua:
##########
@@ -122,6 +123,23 @@ local function create_limit_obj(conf)
end
+local function gen_limit_key(conf, ctx, key)
+ local parent = conf._meta and conf._meta.parent
+ if not parent or not parent.resource_key then
+ core.log.error("failed to generate key invalid parent: ",
core.json.encode(parent))
+ return nil
+ end
+
+ local new_key = parent.resource_key .. ':' ..
apisix_plugin.conf_version(conf)
Review Comment:
```
2026/02/24 01:10:38 [error] 59465#59465: *1486928 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6619&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /get HTTP/1.1", host: "127.0.0.1:9080",
request_id: "1dd149afeab7a65c85aea2fee2d7799e"
2026/02/24 01:10:39 [error] 59472#59472: *1486944 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6618&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /headers HTTP/1.1", host: "127.0.0.1:9080",
request_id: "8cace6edff2ebd5229e9f3484f605eb1"
2026/02/24 01:10:40 [error] 59465#59465: *1487019 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6619&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /get HTTP/1.1", host: "127.0.0.1:9080",
request_id: "3eee5322201e0cce7097ed51577b938f"
2026/02/24 01:10:40 [error] 59479#59479: *1487026 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6618&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /headers HTTP/1.1", host: "127.0.0.1:9080",
request_id: "20afdffb38c3fbe13ac7ed1c809c8888"
2026/02/24 01:11:35 [error] 59478#59478: *1491539 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6619&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /get HTTP/1.1", host: "127.0.0.1:9080",
request_id: "34285dd4f1ba2aef6eec46b78ac5855f"
2026/02/24 01:11:36 [error] 59465#59465: *1491610 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6618&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /headers HTTP/1.1", host: "127.0.0.1:9080",
request_id: "69fc39676a1bcb7c666ffb2eddd3a7ce"
2026/02/24 01:11:36 [error] 59470#59470: *1491623 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6619&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /get HTTP/1.1", host: "127.0.0.1:9080",
request_id: "71c611319270e13f3fa76e69a2eddb8f"
2026/02/24 01:11:37 [error] 59466#59466: *1491692 [lua] limit-req.lua:180:
phase_func(): limit key: /apisix/consumers/jack:6618&34:127.0.0.1, client:
127.0.0.1, server: _, request: "GET /headers HTTP/1.1", host: "127.0.0.1:9080",
request_id: "147ddf0f672c9c67798e6d2bd6952aa1"
```
this is the result when we used the `ctx.conf_version`, we can see that for
those two routes, the keys differ hence failing the
`limit-req-shared-counter.t` test that I made.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]