openresty / lua-resty-limit-traffic

Lua library for limiting and controlling traffic in OpenResty/ngx_lua
821 stars 153 forks source link

Question about race condition in 'count' limiter ('not found' error) #47

Open xv-joosua-l opened 5 years ago

xv-joosua-l commented 5 years ago

Hello,

In this issue: https://github.com/openresty/lua-resty-limit-traffic/issues/23, it is mentioned that lines from 54 to 69 are for handling a race condition, which I suppose is the case when the 'not found' error is returned.

My question is that is it possible for line 56 or 61 to also return a 'not found' error? We are observing a lot of 'not found' errors in our logs. However, if it is expected to encounter these 'not found' errors with high traffic volumes, then I have no further questions.

In general, I would like to know more about the conditions under which the 'not found' error can happen. Isn't it a normal case that keys are sometimes not found in the dictionary? For example, because they were not initialized before.

Thank you in advance.