JanLi-air opened a new issue #2709:
URL: https://github.com/apache/apisix/issues/2709
### Issue description
When configured limit-count plugin in global rule, it sometimes throws error
and respond with 500.
### Environment
* apisix version (cmd: `apisix version`): 2.0
* OS: Linux
### Minimal test code / Steps to reproduce the issue
1. Configure limit-count in global rule like this:
```
"limit-count": {
"count": 1000000000,
"policy": "local",
"key": "remote_addr",
"rejected_code": 429,
"time_window": 1
}
```
2. Repeatly request apisix
3. The error happens after some requests, might need thousands of requests
to reproduce the issue.
### What's the actual result? (including assertion message & call stack if
applicable)
The request got 500 response code due to runtime error in limit-count.lua:
```
2020/11/11 09:48:15 [error] 99#99: *239834 lua entry thread aborted: runtime
error: ...esty/luajit/share/lua/5.1/apisix/plugins/limit-count.lua:167: attempt
to call method 'incoming' (a nil value)
stack traceback:
coroutine 0:
...esty/luajit/share/lua/5.1/apisix/plugins/limit-count.lua: in function
'phase_func'
/usr/local/openresty/luajit/share/lua/5.1/apisix/init.lua:141: in function
'run_plugin'
/usr/local/openresty/luajit/share/lua/5.1/apisix/init.lua:350: in function
'http_access_phase'
access_by_lua(nginx.conf:225):2: in main chunk, client: 172.16.128.215,
server: , request: "GET /apisix/prometheus/metrics HTTP/1.1", host:
"10.212.4.241:8080"
```
### What's the expected result?
The response code should be 200 for normal requests, it should only be 429
when the limit count is reached.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]