-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 metohd for keys return OK insted of value for key (or nil) as Redis message #397
Comments
@MiroBarsa Were you using a Pipeline just before your get()? I experienced the same problem as you on get(), but I resolved it by correctly using sync() as recommended in the wiki (https://github.com/xetorthio/jedis/wiki/AdvancedUsage#pipelining), as opposed to exec(). Not too sure why exec() for Pipeline exists? I think it's a bit of a gotcha, seeing that Transactions use exec(), but it is not so for Pipeline. Another user in the Google Groups also ran into the same trap - https://groups.google.com/forum/#!topic/jedis_redis/d7CVoCIcCzU |
exec is a valid redis command. On Mon, Nov 11, 2013 at 1:38 AM, bakavic notifications@github.com wrote:
|
I am having this issue using the latest jedis. under the same conditions as the original poster above. my code is using the Optimistic Lock pattern in the jedis docs: http://redis.io/topics/transactions
Why was this issue closed? Is there a solution to this problem? |
Make sure the connections sync any pipeline before returning them to the pool. |
We're not using any pipelines in our code. There are a few other places where garbage is being returned for some reason. I see logs like this (all from diffferent parts of the codebase):
We recently made a change where we try to use the same jedis resource if we have two nested I imagine it might be that the resources like these could be interrupting each other under high load? it looks to me that the pool connections are getting mixed up and returning the wrong data? |
Upon further debugging... Even though we are not using piplined anywhere in our code there are places where Is this normal? (Also want to add here that this is a very concurrent system, are there any particular patterns we should follow to avoid issues like this?) |
The common mistake is to share jedis between threads. This will definitely On Tue, Aug 9, 2016 at 12:29 PM Chris Bamford notifications@github.com
|
Hi, I think i found the issue I was having and it was descibed as you said above..
The lambda above was using the resource after it was released and probably assigned to another thread. Removed that and i don't see class cast exceptions anymore, so hopefully OK now.. Thanks for your help :) Are there any plans to make a thread-safe version of jedis in the future? |
Probably after migrating to NIO / Netty. We're slowly moving forward on this side but it will probably take some time. |
Calling method get for Jedis object sometimes return a OK message instead of value of the key (or nil when key does not exist). This happen when asking and setting is very intensive on Redis.
Snippet of code used:
Sometimes return
OK!
I've fixed with a work around (reconnect each time this happens):
I've also checked low level message using Wireshark and comunication protocol it's correct (response nil or value when asked with a GET for a given key).
The text was updated successfully, but these errors were encountered: