Skip to content
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: 500 error when bench limit-count plugin #1901

Closed
UnderTreeTech opened this issue Jul 25, 2020 · 4 comments · Fixed by #1928
Closed

bug: 500 error when bench limit-count plugin #1901

UnderTreeTech opened this issue Jul 25, 2020 · 4 comments · Fixed by #1928
Assignees
Labels
bug Something isn't working

Comments

@UnderTreeTech
Copy link

UnderTreeTech commented Jul 25, 2020

limit count conf:
policy: redis
count: 100
time_window: 60
key: remote_addr
os: CentOS 7.6
benchmark tool: apache benchmark

I got runtime error which result in 500 response when i bench 1million request, 1k concurrency by ab.It seems red:ttl(key) return nil in limit-count-redis.lua. The follow snippet is runtime error detail:

lua entry thread aborted: runtime error: .../apisix/apisix/plugins/limit-count/limit-count-redis.lua:76: attempt to compare nil with number
stack traceback:
coroutine 0:
        .../apisix/apisix/plugins/limit-count/limit-count-redis.lua: in function 'incoming'
        /usr/local/apisix/apisix/plugins/limit-count.lua:121: in function 'phase_fun'
        /usr/local/apisix/apisix/init.lua:147: in function 'run_plugin'
        /usr/local/apisix/apisix/init.lua:385: in function 'http_access_phase'
        access_by_lua(nginx.conf:161):2: in main chunk

Is it a bug? @membphis @moonming

@membphis membphis added the bug Something isn't working label Jul 26, 2020
@membphis
Copy link
Member

yes, that is a bug. we need to check the return value first.
welcome PR ^_^

@UnderTreeTech
Copy link
Author

UnderTreeTech commented Jul 26, 2020

Another issue: in my bench scenario, the redis connections is much more than pool size, there are many timewait , close wait connections, Is pool connection is not reusable long connection? BTW, my pool size is 100 and keepalive timeout is 10 minutes. @membphis

@membphis
Copy link
Member

one issue focus on one thing. if you have another question, please create a new issue.

@shuaijinchao
Copy link
Member

I will deal with this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants