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

get_stale can`t acquire expired key #3

Open
ghost opened this issue Mar 20, 2018 · 0 comments
Open

get_stale can`t acquire expired key #3

ghost opened this issue Mar 20, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 20, 2018

i send an request like this : http://10.74.151.122/api/test007/v1, and i add some log in your codes like this:
local function _get(self, key)
-- always call get_stale() as it does not free element
-- like get does on each call
local data, flags, stale = self.shdict:get_stale(key)
ngx.log(ngx.ERR,"lua----------------------test0: ", data)
ngx.log(ngx.ERR,"lua----------------------test1: ", flags)
ngx.log(ngx.ERR,"lua----------------------test2: ", stale)
ngx.log(ngx.ERR,"lua----------------------test3: ", key)
if data and stale then
if DEBUG then
print("found stale data for key : ", key)
end

  self.stale_data = { data, flags }

  return nil, nil

end

return data, flags
end

at first request, it will log nil for key = A and nil for key = B, where A is a router and B is a http api。
and the second request(less than 10s, i set positive time is 10s), it will log correct infos for both A and B
but the thrid request, only A can get infos form stale memory。 but , B get nil 。 i try to change the shdict size , no results.

all my test like this。send a request , in the 10s , after 10s
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:routing:api:test007:v1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:358: load(): lua----------------------001: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:routing:api:test007:v1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:25 [error] 10675#10675: *7 [lua] shcache.lua:427: load(): lua----------------------005, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: {"enable_host_forward":false,"subdomain":"openpalette.zte.com.cn"}, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: false, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:config:global:apiroute, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:358: load(): lua----------------------001: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:362: load(): lua----------------------002, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: {"kind":"route","apiVersion":"v1","status":"1","metadata":{"name":"test007","version":"v1","namespace":"","serviceName":"test007","serviceVersion":"v1","uid":"","updateTimestamp":"2018-03-20T00:39:17Z","labels":{},"annotations":null},"spec":{"visualRange":"0","url":"/api/msdiscover/v1/config/routerfloatip","publish_port":"","publish_protocol":"http","publish_iplist":"","host":"test007","subdomain":"","apijson":"/api/msdiscover/v1/config/routerfloatip/swagger.json","apijsontype":"1","metricsUrl":"/admin/metrics","lb_policy":"round-robin","consulServiceName":"test007","useOwnUpstream":"0","enable_ssl":false,"enable_http2":false,"enable_client_verify":false,"control":"0","scenario":1,"enable_refer_match":"","connect_timeout":"","send_timeout":"","read_timeout":"","rate_limiting":{"limit_req":{}},"nodes":[{"ip":"10.74.148.68","port":80,"weight":0,"appversion":""}]}}, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: false, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:routing:api:test007:v1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:358: load(): lua----------------------001: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:24:28 [error] 10675#10675: *7 [lua] shcache.lua:362: load(): lua----------------------002, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: {"enable_host_forward":false,"subdomain":"openpalette.zte.com.cn"}, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: true, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:config:global:apiroute, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:358: load(): lua----------------------001: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: {"enable_host_forward":false,"subdomain":"openpalette.zte.com.cn"}, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: 1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: true, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:config:global:apiroute, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:427: load(): lua----------------------005, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:routing:api:test007:v1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:358: load(): lua----------------------001: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:327: _get(): lua----------------------test0: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:328: _get(): lua----------------------test1: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:329: _get(): lua----------------------test2: nil, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:330: _get(): lua----------------------test3: msb:routing:api:test007:v1, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"
2018/03/20 17:25:04 [error] 10675#10675: *7 [lua] shcache.lua:427: load(): lua----------------------005, client: ::ffff:10.74.57.144, server: , request: "GET /api/test007/v1 HTTP/1.1", host: "10.74.151.122"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants