Giter VIP home page Giter VIP logo

Comments (7)

tedpennings avatar tedpennings commented on May 8, 2024

By the way, restarting my servlet container fixes the issue

from jedis.

xetorthio avatar xetorthio commented on May 8, 2024

Thanks for submitting this. Are you sharing Jedis between requests or you are opening a new one for every request?

from jedis.

tedpennings avatar tedpennings commented on May 8, 2024

I believe I am sharing Jedis instances between requests. I'm using a pool to obtain it.

Here is the spring config that creates the JedisPool and the CacheRepository. Because scope isn't specified, it defaults to singleton.

<bean id="jedisPool" class="redis.clients.jedis.JedisPool"
    init-method="init">
    <constructor-arg index="0" value="${redis.host}" />
</bean>

<bean class="com.tedpennings.blog.cache.redis.RedisCacheRepository">
    <constructor-arg index="0" ref="jedisPool" />
    <constructor-arg index="1" value="${redis.json.namespace}" />
    <constructor-arg index="2" value="${redis.json.expiry}" />
</bean>

This issue looks very similar to the issue reported this morning on the google group. I don't think the casts are happening correctly in redis.clients.jedis.Connection

from jedis.

xetorthio avatar xetorthio commented on May 8, 2024

Make sure every request has a different Jedis instance.
If you use JedisPool, you should use getResource() from a request to get a Jedis instance and when finished call returnResource()
You shouldn't share Jedis instances between request because it is not thread safe and wasn't thought for that. You should use JedisPool, which is a thredsafe Jedis factory.
I believe the cast issues you are experiencing are because of sharing Jedis instances. So you call different commands from different threads on the same instance, which leads to trying to get different responses. If they are not executed in order, Jedis instance will be messed up.
I will document that over this weekend. Please let me know if it helped. And if you want realtime answers join the IRC channel.

from jedis.

tedpennings avatar tedpennings commented on May 8, 2024

Thanks, I'll give that a try. We should definitely put up a wiki page on this. I'm happy to contribute code once I get something working (hahaha)

from jedis.

tedpennings avatar tedpennings commented on May 8, 2024

It looks like that fixed it. I ended up using Spring's aspect support to reflectively supply a fresh Jedis instance before each method invocation and return it after. If you want, we could put it in a wiki since there have been a number of questions about this lately.

from jedis.

xetorthio avatar xetorthio commented on May 8, 2024

Great... so I just created a github wiki so everyone can add content. Would you mind adding this please?
http://github.com/xetorthio/jedis/wiki

Thanks a lot!

from jedis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.