red:smembers("key"), sometime not include the new member?
Opened this issue · 6 comments
in my kong lua scripts, I write some code in access function like this:
local redis = require "resty.redis"
local red = redis:new()
red:set_timeouts(5000, 5000, 5000)
local ok, err = red:connect(redisHost, redisPort)
local result, err = red:smembers("all_allow_urls")
local ok, keep_err = red:set_keepalive(10000, 100)
at first, the key "all_allow_urls" in redis is a set, which include 10 members, then I execute SADD all_allow_urls 'aaa' in redis-cli cmd;
but when I visit my kong to check the result from red:smembers("all_allow_urls"), it sometimes include "aaa" but sometimes not。
Can you help me?
the same question, after I execute set key1 value1 in redis-cli cmd,
local result2, err =red:get("key1"), the result2 is userdata: NULL when the red.get_reused_times() > 1, and the result2 is aaa when the red.get_reused_times() == 0.
How to get new data in redis when the data is changed?
Use tcpdump to capture the packets.
And then use wireshark to look into this issue.
Even if rebooting redis and kong doesn't work, the problem remains, do you have some quick solutions? thx
Use tcpdump to capture the packets. And then use wireshark to look into this issue.
The tcp stream that I captured by using kong to operate redis through lua-resty-redis. For the first time, 44 data are normally obtained in the set whose key is api:all_allow_urls, scard it also displays 44 data, and the content of string whose key is bbb is 0000. When the connection is put back into the connection pool and reused to read again, the set contains only 37 data and the contents of the bbb are empty.
Uploading redis_tcp_stream.log…
See attachment for details, Please!
can't find the attachment @yuchao-java
redis_tcp_stream.log
sorry, maybe something wrong, here