Recently in the study of Openresty 1.13.6.1 Version current limit scheme, refer to this document: https://github.com/openresty/lua-resty-limit-traffic/blob/master/lib/resty/ Limit/count.md wrote a time window to call the total number of current limit demo, but the test, encountered the following problems:
2018/03/20 12:38:05 [ERROR] 33074#814554: * LUA entry thread Aborted:runtime error: ... l/cellar/openresty/1.13.6.1/lual Ib/resty/limit/count.lua:53:attempt to call method ' expire ' (a nil value)
Stack Traceback:
Coroutine 0:
... l/cellar/openresty/1.13.6.1/lualib/resty/limit/count.lua:in function ' incoming '
conf/limit_frequency.lua:18:in function ' incoming '
... Ideaprojects/luaapp/work/conf/access_limit_frequency.lua:8: in function < Ideaprojects/luaapp/work/conf/access_limit_frequency.lua:1>, client:10.202.97.23, server:, Request: "GET/ Limitfrequency http/1.1 ", Host:" 10.202.97.23:8080 "
The direct cause of the error is: Openresty/1.13.6.1/lualib/resty/limit/count.lua:53:attempt to call method ' expire ' (a nil value)
At that time the mistake Google A, did not find any solution. The error was then sent to the Google discussion group, and Https://groups.google.com/forum/#!forum/openresty soon responded. It turns out I didn't add resty.core dependencies within the http{} configuration block:
Init_by_lua_block {
Require "Resty.core"
}
In fact, the reference document has a description of the dependent Resty.core, and the original demo also has configuration init_by_lua_block ...
Blame yourself too careless, the original document is not read carefully.